結果
| 問題 | No.935 う し た ぷ に き あ く ん 笑 ビ - ム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-03-24 21:19:48 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 498 bytes | 
| コンパイル時間 | 342 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 135,936 KB | 
| 最終ジャッジ日時 | 2024-11-26 23:25:08 | 
| 合計ジャッジ時間 | 100,670 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 27 TLE * 31 | 
ソースコード
from itertools import accumulate
N = int(input())
S = list(str(input()))
A = list(map(int,input().split()))
Q = int(input())
K = list(map(int,input().split()))
sumA = [0]+list(accumulate(A))
E = [0]
for s in S:
    if s == 'E':
        E.append(1)
    else:
        E.append(0)
sumE = list(accumulate(E))
j = 0
for k in K:
    ans = 0
    for i in range(N+1):
        j = 0
        while j < N+1 and sumA[j]-sumA[i] <= k:
            ans = max(ans,sumE[j]-sumE[i])
            j += 1
    print(ans)
            
            
            
        