結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー flippergoflippergo
提出日時 2020-12-26 12:49:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 280 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 1,104 ms
コンパイル使用メモリ 81,560 KB
実行使用メモリ 73,360 KB
最終ジャッジ日時 2023-10-24 20:51:01
合計ジャッジ時間 10,419 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
66,508 KB
testcase_01 AC 98 ms
68,592 KB
testcase_02 AC 56 ms
63,740 KB
testcase_03 AC 101 ms
66,508 KB
testcase_04 AC 120 ms
71,260 KB
testcase_05 AC 56 ms
64,080 KB
testcase_06 AC 161 ms
70,692 KB
testcase_07 AC 159 ms
73,352 KB
testcase_08 AC 280 ms
70,708 KB
testcase_09 AC 204 ms
73,352 KB
testcase_10 AC 226 ms
73,324 KB
testcase_11 AC 258 ms
73,312 KB
testcase_12 AC 37 ms
53,388 KB
testcase_13 AC 37 ms
53,388 KB
testcase_14 AC 37 ms
53,388 KB
testcase_15 AC 37 ms
53,388 KB
testcase_16 AC 37 ms
53,388 KB
testcase_17 AC 262 ms
66,572 KB
testcase_18 AC 109 ms
68,664 KB
testcase_19 AC 189 ms
70,672 KB
testcase_20 AC 149 ms
70,740 KB
testcase_21 AC 72 ms
66,348 KB
testcase_22 AC 54 ms
63,664 KB
testcase_23 AC 55 ms
64,328 KB
testcase_24 AC 47 ms
61,456 KB
testcase_25 AC 50 ms
61,604 KB
testcase_26 AC 47 ms
61,604 KB
testcase_27 AC 44 ms
59,276 KB
testcase_28 AC 53 ms
64,264 KB
testcase_29 AC 53 ms
64,264 KB
testcase_30 AC 51 ms
62,212 KB
testcase_31 AC 46 ms
61,456 KB
testcase_32 AC 54 ms
64,344 KB
testcase_33 AC 153 ms
70,736 KB
testcase_34 AC 229 ms
73,320 KB
testcase_35 AC 208 ms
70,736 KB
testcase_36 AC 96 ms
68,668 KB
testcase_37 AC 157 ms
73,312 KB
testcase_38 AC 161 ms
70,616 KB
testcase_39 AC 244 ms
73,324 KB
testcase_40 AC 278 ms
73,356 KB
testcase_41 AC 259 ms
73,324 KB
testcase_42 AC 204 ms
70,740 KB
testcase_43 AC 266 ms
73,324 KB
testcase_44 AC 130 ms
70,696 KB
testcase_45 AC 255 ms
73,328 KB
testcase_46 AC 80 ms
68,608 KB
testcase_47 AC 146 ms
70,696 KB
testcase_48 AC 126 ms
71,272 KB
testcase_49 AC 129 ms
68,596 KB
testcase_50 AC 149 ms
73,320 KB
testcase_51 AC 179 ms
73,336 KB
testcase_52 AC 170 ms
73,360 KB
testcase_53 AC 253 ms
73,328 KB
testcase_54 AC 99 ms
68,688 KB
testcase_55 AC 62 ms
66,404 KB
testcase_56 AC 199 ms
70,736 KB
testcase_57 AC 153 ms
71,256 KB
testcase_58 AC 38 ms
53,388 KB
testcase_59 AC 38 ms
53,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input().strip()
A = list(map(int,input().split()))
Q = int(input())
K = list(map(int,input().split()))
BS = [0 for _ in range(N+1)]
for i in range(1,N+1):
    if S[i-1]=="E":
        BS[i] = BS[i-1]+1
    else:
        BS[i] = BS[i-1]
BA = [0 for _ in range(N+1)]
for i in range(1,N+1):
    BA[i] = BA[i-1]+A[i-1]
for j in range(Q):
    k = K[j]
    cmax = 0
    for i in range(N):
        high = N
        low = i-1
        while high-low>1:
            mid = (high+low)//2
            if mid+1<=N and BA[mid+1]-BA[i]>k:
                high = mid
            else:
                low = mid
        ind = high
        cnt = BS[high]-BS[i]
        cmax = max(cmax,cnt)
    print(cmax)
0