結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー O2MTO2MT
提出日時 2021-03-24 22:32:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 339 ms / 2,000 ms
コード長 735 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 78,380 KB
最終ジャッジ日時 2023-08-17 22:38:05
合計ジャッジ時間 13,457 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
76,832 KB
testcase_01 AC 123 ms
78,116 KB
testcase_02 AC 121 ms
77,280 KB
testcase_03 AC 152 ms
77,420 KB
testcase_04 AC 205 ms
77,604 KB
testcase_05 AC 144 ms
77,440 KB
testcase_06 AC 166 ms
78,108 KB
testcase_07 AC 187 ms
78,260 KB
testcase_08 AC 339 ms
78,224 KB
testcase_09 AC 239 ms
78,072 KB
testcase_10 AC 247 ms
78,172 KB
testcase_11 AC 316 ms
78,260 KB
testcase_12 AC 73 ms
71,296 KB
testcase_13 AC 75 ms
71,568 KB
testcase_14 AC 73 ms
71,528 KB
testcase_15 AC 73 ms
71,504 KB
testcase_16 AC 72 ms
71,376 KB
testcase_17 AC 322 ms
78,044 KB
testcase_18 AC 230 ms
77,828 KB
testcase_19 AC 164 ms
78,232 KB
testcase_20 AC 276 ms
77,672 KB
testcase_21 AC 100 ms
77,228 KB
testcase_22 AC 137 ms
77,312 KB
testcase_23 AC 77 ms
75,312 KB
testcase_24 AC 87 ms
76,192 KB
testcase_25 AC 87 ms
76,212 KB
testcase_26 AC 88 ms
77,192 KB
testcase_27 AC 84 ms
76,192 KB
testcase_28 AC 91 ms
76,212 KB
testcase_29 AC 87 ms
76,364 KB
testcase_30 AC 85 ms
76,092 KB
testcase_31 AC 85 ms
76,128 KB
testcase_32 AC 89 ms
76,816 KB
testcase_33 AC 303 ms
77,904 KB
testcase_34 AC 253 ms
78,192 KB
testcase_35 AC 269 ms
78,300 KB
testcase_36 AC 171 ms
77,532 KB
testcase_37 AC 277 ms
77,772 KB
testcase_38 AC 172 ms
78,048 KB
testcase_39 AC 271 ms
78,380 KB
testcase_40 AC 275 ms
78,368 KB
testcase_41 AC 283 ms
78,288 KB
testcase_42 AC 287 ms
78,156 KB
testcase_43 AC 280 ms
78,324 KB
testcase_44 AC 124 ms
78,152 KB
testcase_45 AC 336 ms
78,244 KB
testcase_46 AC 103 ms
77,496 KB
testcase_47 AC 149 ms
78,296 KB
testcase_48 AC 234 ms
77,660 KB
testcase_49 AC 156 ms
78,020 KB
testcase_50 AC 230 ms
77,964 KB
testcase_51 AC 217 ms
78,076 KB
testcase_52 AC 211 ms
78,256 KB
testcase_53 AC 339 ms
78,336 KB
testcase_54 AC 193 ms
77,780 KB
testcase_55 AC 94 ms
77,124 KB
testcase_56 AC 259 ms
78,204 KB
testcase_57 AC 193 ms
78,092 KB
testcase_58 AC 72 ms
71,472 KB
testcase_59 AC 74 ms
71,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
from bisect import bisect_left
N = int(input())
S = list(str(input()))
A = [0]+list(map(int,input().split()))
Q = int(input())
K = list(map(int,input().split()))
KS = sorted(K)
scoreK = [0]*Q
sumA = list(accumulate(A))
E = []
for s in S:
    if s == 'E':
        E.append(1)
    else:
        E.append(0)
sumE = [0]+list(accumulate(E))
for i in range(N+1):
    for j in range(i,N+1):
        cost = sumA[j]-sumA[i]
        enemies = sumE[j]-sumE[i]
        b = bisect_left(KS,cost)
        if b < Q:
            scoreK[b] = max(scoreK[b],enemies)
m = 0
for i in range(Q):
    m = max(scoreK[i],m)
    scoreK[i] = m
mapK = {}
for i in range(Q):
    mapK[KS[i]] = scoreK[i]
for k in K:
    print(mapK[k])
0