結果

問題 No.2693 Sword
ユーザー VvyLwVvyLw
提出日時 2024-03-25 12:39:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,306 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 32,896 KB
最終ジャッジ日時 2024-03-25 12:39:40
合計ジャッジ時間 8,210 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,112 KB
testcase_01 AC 29 ms
10,112 KB
testcase_02 AC 29 ms
10,112 KB
testcase_03 AC 29 ms
10,112 KB
testcase_04 AC 29 ms
10,112 KB
testcase_05 AC 29 ms
10,112 KB
testcase_06 AC 29 ms
10,112 KB
testcase_07 AC 29 ms
10,112 KB
testcase_08 AC 28 ms
10,112 KB
testcase_09 AC 797 ms
32,896 KB
testcase_10 AC 63 ms
11,136 KB
testcase_11 AC 286 ms
17,792 KB
testcase_12 AC 30 ms
10,112 KB
testcase_13 AC 157 ms
13,824 KB
testcase_14 AC 30 ms
10,112 KB
testcase_15 AC 216 ms
18,688 KB
testcase_16 AC 379 ms
25,856 KB
testcase_17 AC 73 ms
17,280 KB
testcase_18 AC 63 ms
13,184 KB
testcase_19 AC 405 ms
15,360 KB
testcase_20 AC 915 ms
24,704 KB
testcase_21 AC 1,306 ms
32,384 KB
testcase_22 AC 619 ms
18,688 KB
testcase_23 AC 390 ms
16,128 KB
testcase_24 AC 30 ms
10,112 KB
testcase_25 AC 30 ms
10,112 KB
testcase_26 AC 28 ms
10,112 KB
testcase_27 AC 29 ms
10,112 KB
testcase_28 AC 30 ms
10,112 KB
testcase_29 AC 30 ms
10,112 KB
testcase_30 AC 36 ms
10,112 KB
testcase_31 AC 30 ms
10,112 KB
testcase_32 AC 75 ms
18,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, p, k = map(int, input().split())
dp = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
dp[0][0] = p
for i in range(n):
    t, b = map(int, input().split())
    for j in range(n):
        if t == 1:
            x = dp[i][j] + b
            if x > 10 ** 18: exit(print(-1))
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], x)
        else:
            x = dp[i][j] * 2
            if x > 10 ** 18: exit(print(-1))
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], x)
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
print(dp[n][k])
0