結果

問題 No.2693 Sword
ユーザー miya145592miya145592
提出日時 2024-03-22 22:12:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 72,612 KB
最終ジャッジ日時 2024-03-22 22:12:54
合計ジャッジ時間 3,003 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 39 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 40 ms
53,460 KB
testcase_08 AC 38 ms
53,460 KB
testcase_09 WA -
testcase_10 AC 51 ms
61,848 KB
testcase_11 AC 57 ms
66,256 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 42 ms
53,460 KB
testcase_15 AC 54 ms
64,044 KB
testcase_16 AC 60 ms
68,600 KB
testcase_17 AC 47 ms
62,080 KB
testcase_18 AC 47 ms
61,836 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 39 ms
53,460 KB
testcase_25 AC 39 ms
53,460 KB
testcase_26 AC 39 ms
53,460 KB
testcase_27 AC 39 ms
53,460 KB
testcase_28 AC 39 ms
53,460 KB
testcase_29 AC 38 ms
53,460 KB
testcase_30 AC 39 ms
53,460 KB
testcase_31 AC 38 ms
53,460 KB
testcase_32 AC 47 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):
        if dp[j]==0:
            continue
        ndp[j] = max(ndp[j], dp[j])
        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