結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,332 KB
testcase_01 AC 36 ms
53,332 KB
testcase_02 AC 37 ms
53,332 KB
testcase_03 AC 37 ms
53,332 KB
testcase_04 AC 37 ms
53,332 KB
testcase_05 AC 38 ms
53,332 KB
testcase_06 AC 37 ms
53,332 KB
testcase_07 AC 37 ms
53,332 KB
testcase_08 AC 37 ms
53,332 KB
testcase_09 AC 74 ms
72,572 KB
testcase_10 AC 51 ms
63,804 KB
testcase_11 AC 61 ms
68,188 KB
testcase_12 AC 37 ms
53,332 KB
testcase_13 AC 55 ms
64,040 KB
testcase_14 AC 50 ms
63,824 KB
testcase_15 AC 95 ms
77,872 KB
testcase_16 AC 89 ms
77,708 KB
testcase_17 AC 118 ms
81,384 KB
testcase_18 AC 72 ms
73,376 KB
testcase_19 AC 69 ms
70,396 KB
testcase_20 AC 59 ms
66,352 KB
testcase_21 AC 65 ms
68,544 KB
testcase_22 AC 74 ms
72,472 KB
testcase_23 AC 57 ms
66,228 KB
testcase_24 WA -
testcase_25 AC 37 ms
53,332 KB
testcase_26 AC 37 ms
53,332 KB
testcase_27 AC 38 ms
53,332 KB
testcase_28 AC 37 ms
53,332 KB
testcase_29 AC 38 ms
53,332 KB
testcase_30 AC 37 ms
53,332 KB
testcase_31 AC 36 ms
53,332 KB
testcase_32 AC 150 ms
91,532 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+1][j+1],dp[i][j]*2)

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