結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー NoneNone
提出日時 2021-10-31 12:27:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 814 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 77,448 KB
最終ジャッジ日時 2024-04-17 05:13:03
合計ジャッジ時間 16,135 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 270 ms
76,488 KB
testcase_07 WA -
testcase_08 AC 522 ms
76,416 KB
testcase_09 AC 346 ms
76,160 KB
testcase_10 AC 426 ms
76,800 KB
testcase_11 WA -
testcase_12 AC 38 ms
51,840 KB
testcase_13 AC 39 ms
51,968 KB
testcase_14 AC 39 ms
51,712 KB
testcase_15 WA -
testcase_16 AC 38 ms
51,840 KB
testcase_17 AC 619 ms
76,416 KB
testcase_18 AC 182 ms
76,340 KB
testcase_19 AC 469 ms
76,416 KB
testcase_20 AC 265 ms
76,196 KB
testcase_21 AC 97 ms
76,144 KB
testcase_22 AC 68 ms
75,008 KB
testcase_23 WA -
testcase_24 AC 61 ms
75,264 KB
testcase_25 AC 62 ms
75,520 KB
testcase_26 AC 52 ms
63,104 KB
testcase_27 AC 47 ms
58,368 KB
testcase_28 WA -
testcase_29 AC 69 ms
75,520 KB
testcase_30 AC 63 ms
71,168 KB
testcase_31 WA -
testcase_32 AC 64 ms
75,264 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 154 ms
76,544 KB
testcase_37 WA -
testcase_38 AC 283 ms
76,160 KB
testcase_39 WA -
testcase_40 AC 458 ms
77,056 KB
testcase_41 WA -
testcase_42 AC 371 ms
76,288 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 213 ms
76,160 KB
testcase_49 WA -
testcase_50 AC 253 ms
76,200 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 AC 436 ms
76,800 KB
testcase_54 AC 155 ms
76,160 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 40 ms
52,224 KB
testcase_59 AC 38 ms
52,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def binary_search_int(ok, ng, test):
    """
    :param ok: solve(x) = True を必ず満たす点
    :param ng: solve(x) = False を必ず満たす点
    """
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if test(mid):
            ok = mid
        else:
            ng = mid
    return ok

##############################################################

import sys
input = sys.stdin.readline



N=int(input())
S=input().rstrip()
A=list(map(int, input().split()))
Q=int(input())
K=list(map(int, input().split()))
SS=[0]
for s in S:
    SS.append(SS[-1]+(s=="E"))
SA=[0]
for a in A:
    SA.append(SA[-1]+a)
for k in K:
    res=0
    for i in range(N):
        def test(x):
            return SA[x]-SA[i]<=k
        r=binary_search_int(i+1,N+1,test)
        res=max(SS[r]-SS[i],res)
    print(res)
0