結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー roarisroaris
提出日時 2019-12-12 16:48:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 199 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 78,168 KB
最終ジャッジ日時 2023-10-12 06:44:43
合計ジャッジ時間 9,521 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
77,744 KB
testcase_01 AC 97 ms
76,804 KB
testcase_02 AC 77 ms
75,544 KB
testcase_03 AC 89 ms
76,304 KB
testcase_04 AC 94 ms
76,528 KB
testcase_05 AC 80 ms
76,004 KB
testcase_06 AC 117 ms
77,824 KB
testcase_07 AC 119 ms
77,692 KB
testcase_08 AC 147 ms
77,640 KB
testcase_09 AC 128 ms
77,716 KB
testcase_10 AC 153 ms
77,516 KB
testcase_11 AC 199 ms
77,536 KB
testcase_12 AC 70 ms
71,136 KB
testcase_13 AC 70 ms
71,488 KB
testcase_14 AC 69 ms
71,124 KB
testcase_15 AC 70 ms
71,292 KB
testcase_16 AC 70 ms
71,468 KB
testcase_17 AC 168 ms
77,620 KB
testcase_18 AC 110 ms
77,200 KB
testcase_19 AC 141 ms
77,480 KB
testcase_20 AC 131 ms
77,124 KB
testcase_21 AC 94 ms
75,624 KB
testcase_22 AC 85 ms
75,696 KB
testcase_23 AC 80 ms
75,480 KB
testcase_24 AC 83 ms
75,624 KB
testcase_25 AC 82 ms
75,572 KB
testcase_26 AC 74 ms
75,336 KB
testcase_27 AC 70 ms
71,320 KB
testcase_28 AC 82 ms
75,680 KB
testcase_29 AC 82 ms
75,544 KB
testcase_30 AC 79 ms
75,596 KB
testcase_31 AC 82 ms
75,704 KB
testcase_32 AC 85 ms
75,540 KB
testcase_33 AC 128 ms
77,300 KB
testcase_34 AC 177 ms
77,888 KB
testcase_35 AC 145 ms
77,568 KB
testcase_36 AC 107 ms
77,036 KB
testcase_37 AC 135 ms
77,276 KB
testcase_38 AC 144 ms
77,760 KB
testcase_39 AC 194 ms
77,980 KB
testcase_40 AC 169 ms
77,696 KB
testcase_41 AC 168 ms
77,588 KB
testcase_42 AC 172 ms
77,840 KB
testcase_43 AC 168 ms
77,716 KB
testcase_44 AC 126 ms
77,600 KB
testcase_45 AC 170 ms
78,064 KB
testcase_46 AC 102 ms
76,988 KB
testcase_47 AC 135 ms
77,368 KB
testcase_48 AC 119 ms
77,136 KB
testcase_49 AC 129 ms
77,664 KB
testcase_50 AC 133 ms
77,128 KB
testcase_51 AC 135 ms
77,760 KB
testcase_52 AC 137 ms
77,588 KB
testcase_53 AC 159 ms
77,920 KB
testcase_54 AC 109 ms
77,112 KB
testcase_55 AC 92 ms
75,416 KB
testcase_56 AC 147 ms
78,168 KB
testcase_57 AC 132 ms
77,916 KB
testcase_58 AC 73 ms
71,264 KB
testcase_59 AC 72 ms
71,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def calc(K):
    r = 0
    res = 0
    k = K

    for l in range(N):
        while r<N and k-A[r]>=0:
            k -= A[r]
            r += 1
        
        res = max(res, acc[r]-acc[l])
        
        if l==r:
            r += 1
        else:
            k += A[l]
    
    return res
            
N = int(input())
S = input()
A = list(map(int, input().split()))
Q = int(input())
K = list(map(int, input().split()))
acc = [0]

for Si in S:
    acc.append(acc[-1]+(1 if Si=='E' else 0))
    
for Ki in K:
    print(calc(Ki))
0