結果
| 問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム | 
| コンテスト | |
| ユーザー |  norioc | 
| 提出日時 | 2025-06-10 10:55:09 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 513 bytes | 
| コンパイル時間 | 414 ms | 
| コンパイル使用メモリ | 82,688 KB | 
| 実行使用メモリ | 70,912 KB | 
| 最終ジャッジ日時 | 2025-06-10 10:55:15 | 
| 合計ジャッジ時間 | 6,031 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 1 | 
| other | AC * 4 WA * 54 | 
ソースコード
from itertools import accumulate
from bisect import bisect_right
def cumsum(seq, reverse=False) -> list:
    if reverse:
        res = cumsum(reversed(seq))
        res.reverse()
        return res
    return list(accumulate(seq))
N = int(input())
S = input()
A = list(map(int, input().split()))
Q = int(input())
K = list(map(int, input().split()))
ss = cumsum(int(c == 'E') for c in S)
xs = cumsum(A)
for k in K:
    p = bisect_right(xs, k)
    if p == 0:
        print(0)
    else:
        print(ss[p-1])
            
            
            
        