結果

問題 No.2693 Sword
ユーザー miya145592miya145592
提出日時 2024-03-22 22:18:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 615 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 72,612 KB
最終ジャッジ日時 2024-03-22 22:18:33
合計ジャッジ時間 3,124 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 39 ms
53,460 KB
testcase_05 AC 39 ms
53,460 KB
testcase_06 AC 39 ms
53,460 KB
testcase_07 AC 39 ms
53,460 KB
testcase_08 AC 39 ms
53,460 KB
testcase_09 AC 71 ms
70,628 KB
testcase_10 AC 53 ms
63,924 KB
testcase_11 AC 60 ms
66,252 KB
testcase_12 AC 39 ms
53,460 KB
testcase_13 AC 56 ms
64,180 KB
testcase_14 AC 39 ms
53,460 KB
testcase_15 AC 56 ms
64,044 KB
testcase_16 AC 61 ms
66,392 KB
testcase_17 AC 48 ms
61,952 KB
testcase_18 AC 50 ms
61,836 KB
testcase_19 AC 72 ms
70,420 KB
testcase_20 AC 63 ms
66,516 KB
testcase_21 AC 65 ms
68,596 KB
testcase_22 AC 80 ms
72,612 KB
testcase_23 AC 61 ms
66,264 KB
testcase_24 AC 39 ms
53,460 KB
testcase_25 AC 38 ms
53,460 KB
testcase_26 AC 39 ms
53,460 KB
testcase_27 AC 39 ms
53,460 KB
testcase_28 AC 38 ms
53,460 KB
testcase_29 AC 39 ms
53,460 KB
testcase_30 AC 38 ms
53,460 KB
testcase_31 AC 38 ms
53,460 KB
testcase_32 AC 46 ms
61,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N, P, K = map(int, input().split())
TB = [list(map(int, input().split())) for _ in range(N)]
dp = [0 for _ in range(K+1)]
dp[0] = P
for i in range(N):
    ndp = [0 for _ in range(K+1)]
    for j in range(K+1):
        if dp[j]==0:
            continue
        ndp[j] = max(ndp[j], dp[j])
        if j+1<=K:
            t, b = TB[i]
            if t==1:
                ndp[j+1] = max(ndp[j+1], dp[j]+b)
            else:
                ndp[j+1] = max(ndp[j+1], dp[j]*2)
            if ndp[j+1]>10**18:
                print(-1)
                exit()
    dp = ndp
print(dp[K])
0