結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー FromBooskaFromBooska
提出日時 2023-03-18 20:46:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,146 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 81,824 KB
実行使用メモリ 76,340 KB
最終ジャッジ日時 2023-10-18 17:33:41
合計ジャッジ時間 21,024 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
75,964 KB
testcase_01 AC 219 ms
76,068 KB
testcase_02 AC 80 ms
75,484 KB
testcase_03 AC 248 ms
75,924 KB
testcase_04 AC 291 ms
76,216 KB
testcase_05 AC 83 ms
75,564 KB
testcase_06 AC 410 ms
76,132 KB
testcase_07 AC 389 ms
76,164 KB
testcase_08 AC 816 ms
76,280 KB
testcase_09 AC 513 ms
76,188 KB
testcase_10 AC 617 ms
76,296 KB
testcase_11 AC 732 ms
76,292 KB
testcase_12 AC 38 ms
53,496 KB
testcase_13 WA -
testcase_14 AC 38 ms
53,496 KB
testcase_15 AC 38 ms
53,496 KB
testcase_16 AC 38 ms
53,496 KB
testcase_17 AC 545 ms
76,188 KB
testcase_18 AC 220 ms
76,068 KB
testcase_19 AC 442 ms
76,124 KB
testcase_20 AC 351 ms
76,092 KB
testcase_21 AC 103 ms
75,812 KB
testcase_22 AC 69 ms
75,228 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 65 ms
75,212 KB
testcase_26 AC 52 ms
63,996 KB
testcase_27 AC 44 ms
59,088 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 388 ms
76,112 KB
testcase_34 AC 628 ms
76,264 KB
testcase_35 AC 575 ms
76,240 KB
testcase_36 AC 193 ms
76,128 KB
testcase_37 AC 381 ms
76,228 KB
testcase_38 AC 383 ms
76,132 KB
testcase_39 AC 654 ms
76,336 KB
testcase_40 AC 708 ms
76,340 KB
testcase_41 AC 698 ms
76,332 KB
testcase_42 AC 546 ms
76,216 KB
testcase_43 AC 729 ms
76,332 KB
testcase_44 AC 283 ms
76,332 KB
testcase_45 AC 730 ms
76,308 KB
testcase_46 AC 132 ms
75,960 KB
testcase_47 AC 331 ms
76,084 KB
testcase_48 AC 267 ms
76,068 KB
testcase_49 AC 291 ms
76,012 KB
testcase_50 AC 355 ms
76,100 KB
testcase_51 AC 416 ms
76,176 KB
testcase_52 AC 410 ms
76,148 KB
testcase_53 AC 640 ms
76,256 KB
testcase_54 AC 193 ms
76,024 KB
testcase_55 AC 85 ms
75,264 KB
testcase_56 AC 509 ms
76,228 KB
testcase_57 AC 360 ms
76,140 KB
testcase_58 AC 40 ms
53,496 KB
testcase_59 AC 39 ms
53,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 累積和、enemy count 
# 任意の場所から打てるときの最大値
# つまりある区間の和がk以下のときのEの数

N = int(input())
S = input()
enemy_count = [0]*(N+1)
for i in range(N):
    if i == 0:
        if S[i] == 'E':
            enemy_count[i+1] = 1
        else:
            enemy_count[i+1] = 0
    else:
        if S[i] == 'E':
            enemy_count[i+1] = enemy_count[i]+1
        else:
            enemy_count[i+1] = enemy_count[i]       
HP = list(map(int, input().split()))
HP_cumu = [0]
temp = 0
for i in range(N):
    temp += HP[i]
    HP_cumu.append(temp)
    
from bisect import *
Q = int(input())
K = list(map(int, input().split()))
for k in K:
    if k == 0:
        print(0)
        continue
    
    ans = 0
    for i in range(N):
        base = HP_cumu[i]
        idx = bisect_left(HP_cumu, base+k)
        #print('k', k, 'idx', idx)
        if idx > N:
            ans = max(ans, enemy_count[N]-enemy_count[i])
        elif HP_cumu[idx] == k:
            ans = max(ans, enemy_count[idx]-enemy_count[i])
        else:
            ans = max(ans, enemy_count[idx-1]-enemy_count[i])
    print(ans)

0