結果

問題 No.2693 Sword
ユーザー kohei🍹kohei🍹
提出日時 2024-03-22 22:11:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 791 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 84,044 KB
最終ジャッジ日時 2024-03-22 22:12:02
合計ジャッジ時間 3,402 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 40 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 39 ms
53,460 KB
testcase_05 AC 39 ms
53,460 KB
testcase_06 AC 39 ms
53,460 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 AC 38 ms
53,460 KB
testcase_09 AC 79 ms
72,968 KB
testcase_10 AC 52 ms
63,936 KB
testcase_11 AC 72 ms
70,916 KB
testcase_12 AC 39 ms
53,460 KB
testcase_13 AC 59 ms
66,772 KB
testcase_14 AC 51 ms
64,084 KB
testcase_15 AC 96 ms
78,136 KB
testcase_16 AC 106 ms
77,900 KB
testcase_17 AC 139 ms
79,636 KB
testcase_18 AC 90 ms
77,024 KB
testcase_19 AC 88 ms
77,916 KB
testcase_20 AC 71 ms
70,928 KB
testcase_21 AC 75 ms
73,012 KB
testcase_22 AC 84 ms
74,800 KB
testcase_23 AC 74 ms
73,020 KB
testcase_24 AC 40 ms
53,460 KB
testcase_25 AC 39 ms
53,460 KB
testcase_26 AC 39 ms
53,460 KB
testcase_27 AC 38 ms
53,460 KB
testcase_28 AC 39 ms
53,460 KB
testcase_29 AC 39 ms
53,460 KB
testcase_30 AC 39 ms
53,460 KB
testcase_31 AC 39 ms
53,460 KB
testcase_32 AC 142 ms
84,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INT = lambda : int(input())
MI = lambda : map(int, input().split())
MI_DEC = lambda : map(lambda x : int(x)-1, input().split())
LI = lambda : list(map(int, input().split()))
LI_DEC = lambda : list(map(lambda x : int(x)-1, input().split()))
INF = float('inf')
CEIL = lambda a, b : (a + b - 1) // b

N, P, K = MI()

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

MAX = 10**18
for i in range(N):
    T, B = MI()

    for j in range(K+1):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])

        if j + 1 > K:
            continue

        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[i+1][j+1] > MAX:
            dp[i+1][j+1] = INF


print(-1 if dp[N][K] == INF else dp[N][K])
0