結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー 👑 timitimi
提出日時 2020-10-26 14:00:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 78,660 KB
最終ジャッジ日時 2023-09-29 02:36:51
合計ジャッジ時間 9,469 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
76,988 KB
testcase_01 AC 111 ms
77,204 KB
testcase_02 AC 97 ms
76,484 KB
testcase_03 AC 107 ms
76,960 KB
testcase_04 AC 121 ms
76,792 KB
testcase_05 AC 98 ms
76,748 KB
testcase_06 AC 111 ms
77,100 KB
testcase_07 AC 131 ms
77,896 KB
testcase_08 AC 153 ms
78,148 KB
testcase_09 AC 153 ms
78,564 KB
testcase_10 AC 152 ms
78,448 KB
testcase_11 AC 147 ms
78,384 KB
testcase_12 AC 77 ms
71,500 KB
testcase_13 AC 76 ms
71,268 KB
testcase_14 AC 77 ms
71,276 KB
testcase_15 AC 79 ms
71,392 KB
testcase_16 AC 76 ms
71,516 KB
testcase_17 AC 146 ms
77,764 KB
testcase_18 AC 122 ms
76,908 KB
testcase_19 AC 118 ms
77,084 KB
testcase_20 AC 165 ms
76,756 KB
testcase_21 AC 94 ms
76,508 KB
testcase_22 AC 95 ms
76,444 KB
testcase_23 AC 79 ms
71,304 KB
testcase_24 AC 86 ms
76,068 KB
testcase_25 AC 85 ms
76,116 KB
testcase_26 AC 83 ms
76,192 KB
testcase_27 AC 83 ms
76,096 KB
testcase_28 AC 85 ms
76,088 KB
testcase_29 AC 89 ms
76,268 KB
testcase_30 AC 86 ms
76,116 KB
testcase_31 AC 84 ms
76,244 KB
testcase_32 AC 89 ms
76,064 KB
testcase_33 AC 143 ms
77,232 KB
testcase_34 AC 140 ms
78,288 KB
testcase_35 AC 140 ms
78,660 KB
testcase_36 AC 112 ms
76,904 KB
testcase_37 AC 137 ms
76,984 KB
testcase_38 AC 115 ms
77,060 KB
testcase_39 AC 163 ms
78,388 KB
testcase_40 AC 144 ms
78,180 KB
testcase_41 AC 167 ms
78,272 KB
testcase_42 AC 150 ms
78,332 KB
testcase_43 AC 166 ms
78,416 KB
testcase_44 AC 109 ms
77,100 KB
testcase_45 AC 186 ms
78,368 KB
testcase_46 AC 96 ms
76,912 KB
testcase_47 AC 112 ms
77,056 KB
testcase_48 AC 123 ms
76,808 KB
testcase_49 AC 121 ms
77,056 KB
testcase_50 AC 126 ms
76,932 KB
testcase_51 AC 127 ms
77,488 KB
testcase_52 AC 124 ms
77,684 KB
testcase_53 AC 155 ms
77,792 KB
testcase_54 AC 115 ms
76,840 KB
testcase_55 AC 90 ms
76,536 KB
testcase_56 AC 140 ms
78,264 KB
testcase_57 AC 133 ms
77,564 KB
testcase_58 AC 77 ms
71,192 KB
testcase_59 AC 76 ms
71,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=input()
A=list(map(int, input().split()))
Q=int(input())
K=list(map(int, input().split()))
E=[0]
H=[0]
e=0
if S=='W'*N:
    for i in range(Q):
        print(0)
    exit()
for i in S:
    if i=='E':
        e+=1 
    E.append(e)
for i in range(N):
    H.append(H[-1]+A[i])
D={}
for l in range(N):
    for r in range(l,N):
        e=E[r+1]-E[l]
        h=H[r+1]-H[l]
        if e not in D:
            D[e]=h
        else:
            D[e]=min(D[e],h)
ans=[]
t=S.count('E')
for i in range(1,t+1):
    ans.append(D[i])
import bisect
for i in range(Q):
    f=bisect.bisect_right(ans,K[i])
    print(f)
0