結果
| 問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-05-07 22:26:57 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 140 ms / 2,000 ms | 
| コード長 | 468 bytes | 
| コンパイル時間 | 192 ms | 
| コンパイル使用メモリ | 82,340 KB | 
| 実行使用メモリ | 74,292 KB | 
| 最終ジャッジ日時 | 2024-07-07 04:29:20 | 
| 合計ジャッジ時間 | 6,230 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 58 | 
ソースコード
n = int(input())
S = input()
A = list(map(int,input().split()))
q = int(input())
K = list(map(int,input().split()))
sK = sorted([[k,i] for i,k in enumerate(K)])
ans = [0]*q
for i in range(n):
    num = 0
    now = i
    hp = 0
    for k,ind in sK:
        while now < n and hp+A[now] <= k:
            hp += A[now]
            if S[now] == "E":
                num += 1
            
            now += 1
        ans[ind] = max(ans[ind],num)
for i in ans:
    print(i)
            
            
            
        