結果

問題 No.2693 Sword
ユーザー sharusharu
提出日時 2024-03-23 01:24:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 433 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-03-23 01:24:10
合計ジャッジ時間 3,693 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,984 KB
testcase_01 AC 31 ms
9,984 KB
testcase_02 AC 31 ms
9,984 KB
testcase_03 AC 30 ms
9,984 KB
testcase_04 AC 30 ms
9,984 KB
testcase_05 AC 31 ms
9,984 KB
testcase_06 AC 31 ms
9,984 KB
testcase_07 AC 30 ms
9,984 KB
testcase_08 AC 31 ms
9,984 KB
testcase_09 AC 433 ms
17,536 KB
testcase_10 AC 53 ms
10,368 KB
testcase_11 AC 206 ms
13,312 KB
testcase_12 AC 30 ms
9,984 KB
testcase_13 AC 60 ms
10,496 KB
testcase_14 AC 30 ms
9,984 KB
testcase_15 AC 95 ms
11,904 KB
testcase_16 AC 91 ms
11,776 KB
testcase_17 AC 38 ms
12,544 KB
testcase_18 AC 35 ms
10,496 KB
testcase_19 AC 242 ms
11,776 KB
testcase_20 AC 51 ms
10,112 KB
testcase_21 AC 87 ms
10,240 KB
testcase_22 AC 281 ms
12,032 KB
testcase_23 AC 61 ms
10,240 KB
testcase_24 AC 31 ms
9,984 KB
testcase_25 AC 30 ms
9,984 KB
testcase_26 AC 30 ms
9,984 KB
testcase_27 AC 30 ms
9,984 KB
testcase_28 AC 32 ms
9,984 KB
testcase_29 AC 31 ms
9,984 KB
testcase_30 AC 30 ms
9,984 KB
testcase_31 AC 30 ms
9,984 KB
testcase_32 AC 48 ms
17,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, p, k = map(int, input().split())
INF = float("INF")
dp = [[-INF] * (k + 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(k + 1):
        dp[i + 1][j] = dp[i][j]
    for j in range(k):
        if t == 1:
            v = dp[i][j] + b
        else:
            v = dp[i][j] * 2
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], v)
        if dp[i + 1][j + 1] > 10**18:
            exit(print(-1))
print(dp[n][k])
0