結果

問題 No.2693 Sword
ユーザー 👑 もぐら 3.0もぐら 3.0
提出日時 2024-03-22 22:11:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 90,508 KB
最終ジャッジ日時 2024-03-22 22:11:59
合計ジャッジ時間 3,389 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,332 KB
testcase_01 AC 38 ms
53,332 KB
testcase_02 AC 39 ms
53,332 KB
testcase_03 AC 39 ms
53,332 KB
testcase_04 AC 39 ms
53,332 KB
testcase_05 AC 40 ms
53,332 KB
testcase_06 AC 38 ms
53,332 KB
testcase_07 AC 38 ms
53,332 KB
testcase_08 AC 39 ms
53,332 KB
testcase_09 AC 75 ms
72,572 KB
testcase_10 AC 54 ms
63,812 KB
testcase_11 AC 64 ms
68,188 KB
testcase_12 AC 43 ms
53,332 KB
testcase_13 AC 59 ms
66,128 KB
testcase_14 AC 53 ms
63,812 KB
testcase_15 AC 97 ms
77,608 KB
testcase_16 AC 91 ms
77,572 KB
testcase_17 AC 122 ms
81,400 KB
testcase_18 AC 78 ms
74,020 KB
testcase_19 AC 73 ms
72,496 KB
testcase_20 AC 61 ms
66,352 KB
testcase_21 AC 66 ms
68,544 KB
testcase_22 AC 76 ms
72,472 KB
testcase_23 AC 58 ms
66,224 KB
testcase_24 WA -
testcase_25 AC 39 ms
53,332 KB
testcase_26 AC 38 ms
53,332 KB
testcase_27 AC 38 ms
53,332 KB
testcase_28 AC 38 ms
53,332 KB
testcase_29 AC 41 ms
53,332 KB
testcase_30 AC 39 ms
53,332 KB
testcase_31 AC 37 ms
53,332 KB
testcase_32 AC 161 ms
90,508 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)]
dp[0][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])
            dp[i+1][j]=max(dp[i][j],dp[i+1][j])
    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)
            dp[i+1][j]=max(dp[i][j],dp[i+1][j])

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