結果

問題 No.935 う し た ぷ に き あ く ん 笑 ビ - ム
ユーザー toyuzukotoyuzuko
提出日時 2020-04-05 20:49:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 77,036 KB
最終ジャッジ日時 2023-09-17 05:44:59
合計ジャッジ時間 8,257 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
76,904 KB
testcase_01 AC 95 ms
76,784 KB
testcase_02 AC 89 ms
76,104 KB
testcase_03 AC 98 ms
76,748 KB
testcase_04 AC 109 ms
76,544 KB
testcase_05 AC 88 ms
76,652 KB
testcase_06 AC 96 ms
76,792 KB
testcase_07 AC 107 ms
76,916 KB
testcase_08 AC 127 ms
76,792 KB
testcase_09 AC 110 ms
76,928 KB
testcase_10 AC 111 ms
76,808 KB
testcase_11 AC 124 ms
76,960 KB
testcase_12 AC 73 ms
71,436 KB
testcase_13 AC 74 ms
71,208 KB
testcase_14 AC 73 ms
71,288 KB
testcase_15 AC 73 ms
71,336 KB
testcase_16 AC 74 ms
71,260 KB
testcase_17 AC 119 ms
76,876 KB
testcase_18 AC 113 ms
76,532 KB
testcase_19 AC 100 ms
76,604 KB
testcase_20 AC 111 ms
77,036 KB
testcase_21 AC 90 ms
76,764 KB
testcase_22 AC 86 ms
75,812 KB
testcase_23 AC 78 ms
75,736 KB
testcase_24 AC 81 ms
75,824 KB
testcase_25 AC 80 ms
75,848 KB
testcase_26 AC 81 ms
75,792 KB
testcase_27 AC 78 ms
75,592 KB
testcase_28 AC 82 ms
75,880 KB
testcase_29 AC 83 ms
75,824 KB
testcase_30 AC 82 ms
76,064 KB
testcase_31 AC 78 ms
75,736 KB
testcase_32 AC 83 ms
75,900 KB
testcase_33 AC 112 ms
76,856 KB
testcase_34 AC 113 ms
76,988 KB
testcase_35 AC 111 ms
76,768 KB
testcase_36 AC 99 ms
76,968 KB
testcase_37 AC 119 ms
76,844 KB
testcase_38 AC 97 ms
76,644 KB
testcase_39 AC 117 ms
76,924 KB
testcase_40 AC 118 ms
76,800 KB
testcase_41 AC 127 ms
76,832 KB
testcase_42 AC 114 ms
76,812 KB
testcase_43 AC 121 ms
76,964 KB
testcase_44 AC 94 ms
76,936 KB
testcase_45 AC 113 ms
76,928 KB
testcase_46 AC 89 ms
76,592 KB
testcase_47 AC 95 ms
76,652 KB
testcase_48 AC 105 ms
77,032 KB
testcase_49 AC 99 ms
76,748 KB
testcase_50 AC 107 ms
76,596 KB
testcase_51 AC 105 ms
76,576 KB
testcase_52 AC 104 ms
76,816 KB
testcase_53 AC 125 ms
76,976 KB
testcase_54 AC 107 ms
76,988 KB
testcase_55 AC 87 ms
76,536 KB
testcase_56 AC 116 ms
76,812 KB
testcase_57 AC 102 ms
76,652 KB
testcase_58 AC 73 ms
71,272 KB
testcase_59 AC 73 ms
71,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 10**18

N = int(input())
S = input()
A = list(map(int, input().split()))
Q = int(input())
K = list(map(int, input().split()))

enemy = [0]

for i in range(N):
    if S[i] == 'E':
        enemy.append(enemy[-1] + 1)
    else:
        enemy.append(enemy[-1])

hp = [0]

for i in range(N):
    hp.append(hp[-1] + A[i])

min_hp = [INF for _ in range(N + 1)]

for i in range(N):
    for j in range(i + 1, N + 1):
        min_hp[enemy[j] - enemy[i]] = min(hp[j] - hp[i], min_hp[enemy[j] - enemy[i]])

for k in range(Q):
    res = 0
    for i in range(N + 1):
        if min_hp[i] <= K[k]:
            res = max(i, res)
    print(res)
0