結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,332 KB
testcase_01 AC 39 ms
53,332 KB
testcase_02 AC 38 ms
53,332 KB
testcase_03 AC 38 ms
53,332 KB
testcase_04 AC 38 ms
53,332 KB
testcase_05 AC 38 ms
53,332 KB
testcase_06 AC 42 ms
53,332 KB
testcase_07 AC 38 ms
53,332 KB
testcase_08 AC 38 ms
53,332 KB
testcase_09 AC 77 ms
72,572 KB
testcase_10 AC 53 ms
63,804 KB
testcase_11 AC 63 ms
68,188 KB
testcase_12 AC 39 ms
53,332 KB
testcase_13 AC 55 ms
64,040 KB
testcase_14 AC 52 ms
63,824 KB
testcase_15 AC 104 ms
77,868 KB
testcase_16 AC 89 ms
77,708 KB
testcase_17 AC 122 ms
81,512 KB
testcase_18 AC 74 ms
73,248 KB
testcase_19 AC 71 ms
70,400 KB
testcase_20 AC 59 ms
66,352 KB
testcase_21 AC 65 ms
68,544 KB
testcase_22 AC 75 ms
72,472 KB
testcase_23 AC 59 ms
66,228 KB
testcase_24 WA -
testcase_25 AC 38 ms
53,332 KB
testcase_26 AC 38 ms
53,332 KB
testcase_27 AC 39 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 39 ms
53,332 KB
testcase_32 AC 167 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)]
dp[0][0]=P
for i in range(N):
    if TB[i][0]==1:
        for j in range(K):
            dp[i+1][j]=max(dp[i][j],dp[i+1][j])
            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):
            dp[i+1][j]=max(dp[i][j],dp[i+1][j])
            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