結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー kohei2019kohei2019
提出日時 2022-05-14 17:03:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,492 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 86,228 KB
実行使用メモリ 78,896 KB
最終ジャッジ日時 2023-09-30 08:55:23
合計ジャッジ時間 36,093 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 162 ms
77,468 KB
testcase_01 AC 434 ms
77,736 KB
testcase_02 AC 133 ms
77,172 KB
testcase_03 AC 462 ms
77,788 KB
testcase_04 AC 533 ms
78,104 KB
testcase_05 AC 140 ms
77,212 KB
testcase_06 AC 757 ms
77,760 KB
testcase_07 AC 714 ms
78,112 KB
testcase_08 AC 1,492 ms
77,900 KB
testcase_09 AC 958 ms
77,940 KB
testcase_10 AC 1,101 ms
77,576 KB
testcase_11 AC 1,376 ms
77,928 KB
testcase_12 AC 70 ms
70,932 KB
testcase_13 AC 71 ms
70,916 KB
testcase_14 AC 72 ms
70,712 KB
testcase_15 AC 71 ms
70,936 KB
testcase_16 AC 71 ms
70,928 KB
testcase_17 AC 843 ms
77,536 KB
testcase_18 AC 372 ms
78,152 KB
testcase_19 AC 814 ms
77,968 KB
testcase_20 AC 621 ms
77,808 KB
testcase_21 AC 181 ms
77,036 KB
testcase_22 AC 115 ms
76,388 KB
testcase_23 AC 105 ms
77,308 KB
testcase_24 AC 103 ms
76,828 KB
testcase_25 AC 103 ms
76,576 KB
testcase_26 AC 86 ms
76,204 KB
testcase_27 AC 78 ms
74,896 KB
testcase_28 AC 104 ms
76,644 KB
testcase_29 AC 108 ms
76,600 KB
testcase_30 AC 101 ms
76,804 KB
testcase_31 AC 102 ms
76,784 KB
testcase_32 AC 106 ms
76,496 KB
testcase_33 AC 698 ms
77,528 KB
testcase_34 AC 1,130 ms
77,876 KB
testcase_35 AC 1,037 ms
78,032 KB
testcase_36 AC 334 ms
77,784 KB
testcase_37 AC 688 ms
77,660 KB
testcase_38 AC 703 ms
77,692 KB
testcase_39 AC 1,189 ms
78,036 KB
testcase_40 AC 1,357 ms
78,524 KB
testcase_41 AC 1,312 ms
77,892 KB
testcase_42 AC 990 ms
77,808 KB
testcase_43 AC 1,327 ms
78,116 KB
testcase_44 AC 523 ms
77,712 KB
testcase_45 AC 1,349 ms
78,052 KB
testcase_46 AC 231 ms
77,748 KB
testcase_47 AC 597 ms
77,480 KB
testcase_48 AC 472 ms
78,004 KB
testcase_49 AC 525 ms
77,748 KB
testcase_50 AC 642 ms
78,144 KB
testcase_51 AC 756 ms
78,092 KB
testcase_52 AC 744 ms
78,896 KB
testcase_53 AC 1,168 ms
77,812 KB
testcase_54 AC 336 ms
77,956 KB
testcase_55 AC 146 ms
77,336 KB
testcase_56 AC 971 ms
78,024 KB
testcase_57 AC 662 ms
78,128 KB
testcase_58 AC 69 ms
70,568 KB
testcase_59 AC 68 ms
71,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
N = int(input())
S = input()
lsA = list(map(int,input().split()))
Q = int(input())
lsK = list(map(int,input().split()))

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

lssum = [0]
for i in range(N):
    lssum.append(lssum[-1]+lsA[i])

for i in range(Q):
    q = lsK[i]
    ans = 0
    for j in range(1,N+1):
        d = lssum[j]
        v = d - q
        ind = bisect.bisect_left(lssum, v)
        ecnt1 = ll[j]-ll[ind]

        d = lssum[j-1]
        v = d+q
        ind = bisect.bisect_right(lssum, v)
        ecnt2 = ll[ind-1]-ll[j-1]
        ans = max(ans,ecnt1,ecnt2)
    print(ans)
0