結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
コンテスト
ユーザー norioc
提出日時 2025-06-10 10:55:09
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 513 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 226 ms
コンパイル使用メモリ 96,100 KB
実行使用メモリ 84,736 KB
最終ジャッジ日時 2026-07-11 07:12:16
合計ジャッジ時間 7,168 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 4 WA * 54
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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])
0