結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
9,984 KB
testcase_01 AC 31 ms
9,984 KB
testcase_02 AC 31 ms
9,984 KB
testcase_03 AC 32 ms
9,984 KB
testcase_04 AC 31 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 465 ms
17,536 KB
testcase_10 AC 54 ms
10,368 KB
testcase_11 AC 214 ms
13,312 KB
testcase_12 AC 32 ms
9,984 KB
testcase_13 AC 60 ms
10,496 KB
testcase_14 AC 31 ms
9,984 KB
testcase_15 AC 100 ms
11,904 KB
testcase_16 AC 88 ms
11,776 KB
testcase_17 AC 41 ms
12,544 KB
testcase_18 AC 37 ms
10,496 KB
testcase_19 AC 246 ms
11,776 KB
testcase_20 AC 53 ms
10,112 KB
testcase_21 AC 70 ms
10,240 KB
testcase_22 AC 278 ms
12,032 KB
testcase_23 AC 60 ms
10,240 KB
testcase_24 WA -
testcase_25 AC 32 ms
9,984 KB
testcase_26 AC 31 ms
9,984 KB
testcase_27 AC 32 ms
9,984 KB
testcase_28 AC 32 ms
9,984 KB
testcase_29 AC 31 ms
9,984 KB
testcase_30 AC 31 ms
9,984 KB
testcase_31 AC 31 ms
9,984 KB
testcase_32 AC 53 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