結果

問題 No.2693 Sword
ユーザー hibit_athibit_at
提出日時 2024-02-09 08:52:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 277 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 192,336 KB
最終ジャッジ日時 2024-02-09 13:35:09
合計ジャッジ時間 2,855 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,332 KB
testcase_01 AC 30 ms
53,332 KB
testcase_02 AC 32 ms
53,332 KB
testcase_03 AC 36 ms
53,332 KB
testcase_04 AC 30 ms
53,332 KB
testcase_05 AC 31 ms
53,332 KB
testcase_06 AC 30 ms
53,332 KB
testcase_07 AC 30 ms
53,332 KB
testcase_08 AC 30 ms
53,332 KB
testcase_09 AC 61 ms
73,096 KB
testcase_10 AC 41 ms
61,724 KB
testcase_11 AC 64 ms
70,780 KB
testcase_12 AC 32 ms
53,332 KB
testcase_13 AC 47 ms
66,648 KB
testcase_14 AC 40 ms
61,728 KB
testcase_15 AC 91 ms
77,792 KB
testcase_16 AC 79 ms
77,888 KB
testcase_17 AC 107 ms
81,356 KB
testcase_18 AC 75 ms
76,892 KB
testcase_19 AC 67 ms
74,560 KB
testcase_20 AC 59 ms
73,036 KB
testcase_21 AC 63 ms
73,552 KB
testcase_22 AC 65 ms
74,400 KB
testcase_23 AC 58 ms
70,808 KB
testcase_24 AC 32 ms
53,332 KB
testcase_25 AC 32 ms
53,332 KB
testcase_26 AC 30 ms
53,332 KB
testcase_27 AC 30 ms
53,332 KB
testcase_28 AC 31 ms
53,332 KB
testcase_29 AC 31 ms
53,332 KB
testcase_30 AC 32 ms
53,332 KB
testcase_31 AC 32 ms
53,332 KB
testcase_32 AC 277 ms
192,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,p,k = list(map(int, input().split(' ')))
dp = [[p] * (k+1) for i in range(n+1)]
for i in range(n):
    t,b = list(map(int, input().split(' ')))
    for j in range(k+1):
        dp[i+1][j] = max(dp[i+1][j],dp[i][j])
        if j + 1 <= k:
            if t == 1:
                dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j] + b)
            else:
                dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]*2)
if dp[n][k] > 1e18:
    print(-1)
else:
    print(dp[n][k])
0