結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー 👑 KazunKazun
提出日時 2021-02-07 19:14:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 963 ms / 2,000 ms
コード長 1,030 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 86,832 KB
実行使用メモリ 94,412 KB
最終ジャッジ日時 2023-09-17 17:36:30
合計ジャッジ時間 19,015 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
77,848 KB
testcase_01 AC 125 ms
78,816 KB
testcase_02 AC 105 ms
78,828 KB
testcase_03 AC 133 ms
81,408 KB
testcase_04 AC 156 ms
85,324 KB
testcase_05 AC 109 ms
80,812 KB
testcase_06 AC 268 ms
82,004 KB
testcase_07 AC 271 ms
82,916 KB
testcase_08 AC 585 ms
94,096 KB
testcase_09 AC 363 ms
86,760 KB
testcase_10 AC 422 ms
87,624 KB
testcase_11 AC 551 ms
92,044 KB
testcase_12 AC 76 ms
70,844 KB
testcase_13 AC 76 ms
70,976 KB
testcase_14 AC 76 ms
71,012 KB
testcase_15 AC 76 ms
71,088 KB
testcase_16 AC 77 ms
71,352 KB
testcase_17 AC 963 ms
94,412 KB
testcase_18 AC 275 ms
86,936 KB
testcase_19 AC 428 ms
81,864 KB
testcase_20 AC 398 ms
90,900 KB
testcase_21 AC 127 ms
77,480 KB
testcase_22 AC 111 ms
80,108 KB
testcase_23 AC 93 ms
75,864 KB
testcase_24 AC 103 ms
76,680 KB
testcase_25 AC 96 ms
75,812 KB
testcase_26 AC 89 ms
76,032 KB
testcase_27 AC 81 ms
75,660 KB
testcase_28 AC 95 ms
76,032 KB
testcase_29 AC 100 ms
76,668 KB
testcase_30 AC 96 ms
76,224 KB
testcase_31 AC 94 ms
75,992 KB
testcase_32 AC 94 ms
75,812 KB
testcase_33 AC 328 ms
92,132 KB
testcase_34 AC 452 ms
88,596 KB
testcase_35 AC 401 ms
88,408 KB
testcase_36 AC 184 ms
82,272 KB
testcase_37 AC 340 ms
90,104 KB
testcase_38 AC 279 ms
82,068 KB
testcase_39 AC 482 ms
88,816 KB
testcase_40 AC 523 ms
89,392 KB
testcase_41 AC 502 ms
90,080 KB
testcase_42 AC 426 ms
90,364 KB
testcase_43 AC 514 ms
89,864 KB
testcase_44 AC 197 ms
79,008 KB
testcase_45 AC 568 ms
94,056 KB
testcase_46 AC 134 ms
77,704 KB
testcase_47 AC 232 ms
81,092 KB
testcase_48 AC 249 ms
87,668 KB
testcase_49 AC 224 ms
80,964 KB
testcase_50 AC 296 ms
86,764 KB
testcase_51 AC 308 ms
85,392 KB
testcase_52 AC 306 ms
84,528 KB
testcase_53 AC 493 ms
93,832 KB
testcase_54 AC 191 ms
84,700 KB
testcase_55 AC 111 ms
77,488 KB
testcase_56 AC 388 ms
88,272 KB
testcase_57 AC 265 ms
83,516 KB
testcase_58 AC 76 ms
71,124 KB
testcase_59 AC 75 ms
71,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Binary_Search_Small_Count(A,x,equal=False,sort=False):
    """2分探索によって,x未満の要素の個数を調べる.

    A:リスト
    x:調べる要素
    sort:ソートをする必要があるかどうか(Trueで必要)
    equal:Trueのときはx"未満"がx"以下"になる
    """
    if sort:
        A.sort()

    if A[0]>x or ((not equal) and A[0]==x):
        return 0

    L,R=0,len(A)
    while R-L>1:
        C=L+(R-L)//2
        if A[C]<x or (equal and A[C]==x):
            L=C
        else:
            R=C

    return L+1
#================================================
N=int(input())
S=input()
A=list(map(int,input().split()))
Q=int(input())
K=list(map(int,input().split()))

T=[]
for i in range(N):
    U=[]
    u=0
    for j in range(i,N):
        u+=A[j]
        U.append(u)
    T.append(U)

V=[0];v=0
for s in S:
    if s=="E":
        v+=1
    V.append(v)

for k in K:
    X=0
    for i in range(N):
        p=Binary_Search_Small_Count(T[i],k,True)
        X=max(X,V[i+p]-V[i])
    print(X)
0