結果
| 問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム |
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2020-04-11 06:25:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 164 ms / 2,000 ms |
| コード長 | 623 bytes |
| 記録 | |
| コンパイル時間 | 154 ms |
| コンパイル使用メモリ | 82,264 KB |
| 実行使用メモリ | 75,392 KB |
| 最終ジャッジ日時 | 2024-09-17 10:07:46 |
| 合計ジャッジ時間 | 7,219 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 58 |
ソースコード
n = int(input())
s = str(input())
A = list(map(int, input().split()))
q = int(input())
K = list(map(int, input().split()))
B = [0]*n
for i in range(n):
if s[i] == 'E':
B[i] = 1
from itertools import accumulate
C = [0]+B
C = list(accumulate(C))
for i in range(q):
x = 0
y = 0
S = 0
ans = -1
for x in range(n):
while y < n and S <= K[i]:
S += A[y]
y += 1
if S <= K[i]:
ans = max(ans, C[y]-C[x])
else:
ans = max(ans, C[y-1]-C[x])
if x == y:
y += 1
else:
S -= A[x]
print(ans)
brthyyjp