結果

問題 No.2693 Sword
ユーザー 👑 もぐら 3.0もぐら 3.0
提出日時 2024-03-22 22:16:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 90,380 KB
最終ジャッジ日時 2024-03-22 22:16:34
合計ジャッジ時間 3,297 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,332 KB
testcase_01 AC 38 ms
53,332 KB
testcase_02 AC 38 ms
53,332 KB
testcase_03 AC 38 ms
53,332 KB
testcase_04 AC 37 ms
53,332 KB
testcase_05 AC 37 ms
53,332 KB
testcase_06 AC 38 ms
53,332 KB
testcase_07 AC 37 ms
53,332 KB
testcase_08 AC 38 ms
53,332 KB
testcase_09 AC 78 ms
68,392 KB
testcase_10 AC 49 ms
61,704 KB
testcase_11 AC 56 ms
66,096 KB
testcase_12 AC 38 ms
53,332 KB
testcase_13 AC 52 ms
64,040 KB
testcase_14 AC 47 ms
61,724 KB
testcase_15 AC 85 ms
77,328 KB
testcase_16 AC 73 ms
72,732 KB
testcase_17 AC 102 ms
78,592 KB
testcase_18 AC 68 ms
72,600 KB
testcase_19 AC 64 ms
68,300 KB
testcase_20 AC 57 ms
66,352 KB
testcase_21 AC 61 ms
68,568 KB
testcase_22 AC 65 ms
70,384 KB
testcase_23 AC 55 ms
64,148 KB
testcase_24 AC 38 ms
53,332 KB
testcase_25 AC 37 ms
53,332 KB
testcase_26 AC 38 ms
53,332 KB
testcase_27 AC 38 ms
53,332 KB
testcase_28 AC 39 ms
53,332 KB
testcase_29 AC 38 ms
53,332 KB
testcase_30 AC 38 ms
53,332 KB
testcase_31 AC 38 ms
53,332 KB
testcase_32 AC 143 ms
90,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P,K = map(int,input().split())
TB = [list(map(int,input().split()))for _ in range(N)]

dp=[[0]*(K+1)for i in range(N+1)]
for i in range(N+1):
    dp[i][0]=P

for i in range(N):
    if TB[i][0]==1:
        for j in range(K):
            if dp[i][j]>0:
                dp[i+1][j+1]=max(dp[i][j+1],dp[i][j]+TB[i][1])
    else:
        for j in range(K):
            if dp[i][j]>0:
                dp[i+1][j+1]=max(dp[i][j+1],dp[i][j]*2)

if dp[-1][-1]>10**18:
    print(-1)
else:
    print(dp[-1][-1])
0