結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー brthyyjpbrthyyjp
提出日時 2020-04-11 06:25:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 623 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 81,552 KB
実行使用メモリ 74,868 KB
最終ジャッジ日時 2023-10-17 11:56:21
合計ジャッジ時間 9,316 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
68,624 KB
testcase_01 AC 72 ms
68,612 KB
testcase_02 AC 52 ms
61,632 KB
testcase_03 AC 79 ms
66,536 KB
testcase_04 AC 78 ms
68,728 KB
testcase_05 AC 55 ms
64,160 KB
testcase_06 AC 100 ms
70,720 KB
testcase_07 AC 97 ms
70,796 KB
testcase_08 AC 137 ms
73,380 KB
testcase_09 AC 118 ms
73,392 KB
testcase_10 AC 123 ms
73,392 KB
testcase_11 AC 153 ms
70,764 KB
testcase_12 AC 39 ms
53,416 KB
testcase_13 AC 38 ms
53,416 KB
testcase_14 AC 38 ms
53,416 KB
testcase_15 AC 39 ms
53,416 KB
testcase_16 AC 38 ms
53,416 KB
testcase_17 AC 98 ms
66,628 KB
testcase_18 AC 88 ms
73,368 KB
testcase_19 AC 112 ms
66,532 KB
testcase_20 AC 112 ms
74,868 KB
testcase_21 AC 75 ms
70,648 KB
testcase_22 AC 53 ms
63,736 KB
testcase_23 AC 52 ms
63,680 KB
testcase_24 AC 49 ms
61,600 KB
testcase_25 AC 53 ms
63,756 KB
testcase_26 AC 45 ms
59,544 KB
testcase_27 AC 39 ms
53,416 KB
testcase_28 AC 59 ms
65,848 KB
testcase_29 AC 56 ms
63,772 KB
testcase_30 AC 50 ms
61,604 KB
testcase_31 AC 52 ms
63,688 KB
testcase_32 AC 49 ms
61,600 KB
testcase_33 AC 101 ms
70,772 KB
testcase_34 AC 152 ms
73,360 KB
testcase_35 AC 119 ms
70,748 KB
testcase_36 AC 76 ms
68,700 KB
testcase_37 AC 107 ms
72,832 KB
testcase_38 AC 107 ms
72,828 KB
testcase_39 AC 147 ms
70,780 KB
testcase_40 AC 165 ms
73,380 KB
testcase_41 AC 159 ms
73,376 KB
testcase_42 AC 118 ms
70,772 KB
testcase_43 AC 150 ms
73,652 KB
testcase_44 AC 100 ms
73,312 KB
testcase_45 AC 148 ms
73,716 KB
testcase_46 AC 69 ms
66,536 KB
testcase_47 AC 103 ms
68,624 KB
testcase_48 AC 94 ms
71,320 KB
testcase_49 AC 101 ms
72,828 KB
testcase_50 AC 107 ms
73,368 KB
testcase_51 AC 112 ms
73,388 KB
testcase_52 AC 114 ms
70,748 KB
testcase_53 AC 148 ms
70,780 KB
testcase_54 AC 81 ms
70,784 KB
testcase_55 AC 59 ms
63,688 KB
testcase_56 AC 121 ms
73,372 KB
testcase_57 AC 103 ms
73,384 KB
testcase_58 AC 38 ms
53,416 KB
testcase_59 AC 38 ms
53,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0