結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2019-11-29 22:23:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 339 ms / 2,000 ms
コード長 654 bytes
コンパイル時間 455 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 77,692 KB
最終ジャッジ日時 2023-10-12 06:25:32
合計ジャッジ時間 13,090 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
76,572 KB
testcase_01 AC 141 ms
76,984 KB
testcase_02 AC 94 ms
75,800 KB
testcase_03 AC 149 ms
76,928 KB
testcase_04 AC 160 ms
77,520 KB
testcase_05 AC 95 ms
76,352 KB
testcase_06 AC 205 ms
76,928 KB
testcase_07 AC 198 ms
77,016 KB
testcase_08 AC 339 ms
77,524 KB
testcase_09 AC 251 ms
77,520 KB
testcase_10 AC 279 ms
77,616 KB
testcase_11 AC 325 ms
76,984 KB
testcase_12 AC 75 ms
71,008 KB
testcase_13 AC 75 ms
71,180 KB
testcase_14 AC 76 ms
71,208 KB
testcase_15 AC 77 ms
71,452 KB
testcase_16 AC 77 ms
70,996 KB
testcase_17 AC 331 ms
76,728 KB
testcase_18 AC 155 ms
77,596 KB
testcase_19 AC 233 ms
76,724 KB
testcase_20 AC 201 ms
76,960 KB
testcase_21 AC 113 ms
76,620 KB
testcase_22 AC 93 ms
75,764 KB
testcase_23 AC 88 ms
75,788 KB
testcase_24 AC 84 ms
75,956 KB
testcase_25 AC 87 ms
75,752 KB
testcase_26 AC 84 ms
75,972 KB
testcase_27 AC 84 ms
75,816 KB
testcase_28 AC 91 ms
76,704 KB
testcase_29 AC 94 ms
76,924 KB
testcase_30 AC 87 ms
75,932 KB
testcase_31 AC 87 ms
75,976 KB
testcase_32 AC 93 ms
76,740 KB
testcase_33 AC 213 ms
77,336 KB
testcase_34 AC 294 ms
77,564 KB
testcase_35 AC 274 ms
77,024 KB
testcase_36 AC 140 ms
77,692 KB
testcase_37 AC 204 ms
76,764 KB
testcase_38 AC 206 ms
76,668 KB
testcase_39 AC 301 ms
76,940 KB
testcase_40 AC 324 ms
76,712 KB
testcase_41 AC 322 ms
77,032 KB
testcase_42 AC 265 ms
77,012 KB
testcase_43 AC 334 ms
77,272 KB
testcase_44 AC 165 ms
76,676 KB
testcase_45 AC 330 ms
76,956 KB
testcase_46 AC 121 ms
76,980 KB
testcase_47 AC 181 ms
76,900 KB
testcase_48 AC 170 ms
77,588 KB
testcase_49 AC 174 ms
76,972 KB
testcase_50 AC 196 ms
76,964 KB
testcase_51 AC 209 ms
77,020 KB
testcase_52 AC 214 ms
77,496 KB
testcase_53 AC 299 ms
76,972 KB
testcase_54 AC 140 ms
77,532 KB
testcase_55 AC 105 ms
76,844 KB
testcase_56 AC 244 ms
77,508 KB
testcase_57 AC 204 ms
77,560 KB
testcase_58 AC 79 ms
71,116 KB
testcase_59 AC 77 ms
71,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

S = input()

A = list(map(int,input().split()))
AS = [0]

for i in range(N):
    AS.append(AS[-1] + A[i])

AS.append(float("inf"))

SS = [0]
for i in range(N):
    if S[i] == "E":
        SS.append(SS[-1] + 1)
    else:
        SS.append(SS[-1])

Q = int(input())
K = list(map(int,input().split()))

for loop in range(Q):

    nk = K[loop]
    nans = 0

    for root in range(N):

        l = root
        r = N + 1

        while r - l != 1:

            m = (l+r) // 2
            if AS[m] - AS[root] > nk:
                r = m
            else:
                l = m

        nans = max(nans , SS[l] - SS[root] )

    print (nans)
0