結果
| 問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2025-06-10 11:14:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 555 ms / 2,000 ms |
| コード長 | 594 bytes |
| コンパイル時間 | 605 ms |
| コンパイル使用メモリ | 82,332 KB |
| 実行使用メモリ | 80,196 KB |
| 最終ジャッジ日時 | 2025-06-10 11:14:43 |
| 合計ジャッジ時間 | 16,701 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 58 |
ソースコード
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()))
t = [0] * Q
for i in range(N):
ss = cumsum(int(c == 'E') for c in S[i:])
xs = cumsum(A[i:])
for j, k in enumerate(K):
p = bisect_right(xs, k)
if p > 0:
t[j] = max(t[j], ss[p-1])
print(*t, sep='\n')
norioc