結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー ああいいああいい
提出日時 2022-03-13 22:45:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 626 bytes
コンパイル時間 1,072 ms
コンパイル使用メモリ 81,228 KB
実行使用メモリ 76,304 KB
最終ジャッジ日時 2023-10-19 10:13:03
合計ジャッジ時間 7,867 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
75,892 KB
testcase_01 AC 68 ms
68,660 KB
testcase_02 AC 46 ms
59,136 KB
testcase_03 AC 61 ms
65,992 KB
testcase_04 AC 64 ms
66,236 KB
testcase_05 AC 50 ms
61,816 KB
testcase_06 AC 92 ms
75,956 KB
testcase_07 AC 95 ms
76,028 KB
testcase_08 AC 125 ms
76,116 KB
testcase_09 AC 105 ms
76,036 KB
testcase_10 AC 135 ms
76,304 KB
testcase_11 AC 180 ms
76,076 KB
testcase_12 AC 39 ms
53,380 KB
testcase_13 AC 39 ms
53,380 KB
testcase_14 AC 39 ms
53,380 KB
testcase_15 AC 39 ms
53,380 KB
testcase_16 AC 38 ms
53,380 KB
testcase_17 AC 149 ms
76,092 KB
testcase_18 AC 88 ms
75,500 KB
testcase_19 AC 117 ms
76,040 KB
testcase_20 AC 106 ms
75,556 KB
testcase_21 AC 66 ms
71,716 KB
testcase_22 AC 54 ms
63,432 KB
testcase_23 AC 50 ms
61,352 KB
testcase_24 AC 51 ms
63,408 KB
testcase_25 AC 51 ms
61,360 KB
testcase_26 AC 43 ms
59,124 KB
testcase_27 AC 39 ms
53,380 KB
testcase_28 AC 52 ms
63,468 KB
testcase_29 AC 51 ms
63,388 KB
testcase_30 AC 49 ms
61,200 KB
testcase_31 AC 54 ms
63,428 KB
testcase_32 AC 56 ms
63,448 KB
testcase_33 AC 103 ms
75,540 KB
testcase_34 AC 156 ms
76,136 KB
testcase_35 AC 121 ms
76,032 KB
testcase_36 AC 80 ms
75,488 KB
testcase_37 AC 113 ms
75,592 KB
testcase_38 AC 124 ms
75,988 KB
testcase_39 AC 170 ms
76,068 KB
testcase_40 AC 147 ms
76,148 KB
testcase_41 AC 147 ms
76,216 KB
testcase_42 AC 152 ms
76,108 KB
testcase_43 AC 148 ms
76,140 KB
testcase_44 AC 104 ms
76,004 KB
testcase_45 AC 150 ms
76,164 KB
testcase_46 AC 79 ms
75,300 KB
testcase_47 AC 121 ms
75,960 KB
testcase_48 AC 94 ms
75,488 KB
testcase_49 AC 109 ms
75,956 KB
testcase_50 AC 111 ms
75,504 KB
testcase_51 AC 115 ms
76,132 KB
testcase_52 AC 115 ms
76,116 KB
testcase_53 AC 138 ms
76,132 KB
testcase_54 AC 83 ms
75,512 KB
testcase_55 AC 63 ms
67,628 KB
testcase_56 AC 122 ms
76,116 KB
testcase_57 AC 107 ms
76,064 KB
testcase_58 AC 39 ms
53,380 KB
testcase_59 AC 39 ms
53,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
A = list(map(int,input().split()))

teki = [0] * (N + 1)
for i in range(N):
    teki[i+1] = teki[i]
    if S[i] == "E":
        teki[i+1] += 1
def calc(k):
    right = 0
    now = 0
    ans = 0
    for left in range(N):
        while right < N and now + A[right] <= k:
            now += A[right]
            right += 1
        count = teki[right] - teki[left]
        if count > ans:
            ans = count
        if left == right:
            right += 1
        else:
            now -= A[left]
    return ans
Q = int(input())
K = list(map(int,input().split()))
for k in K:
    print(calc(k))
0