結果

問題 No.1947 質より種類数
ユーザー tktk_snsntktk_snsn
提出日時 2022-05-21 16:33:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 292 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 11,744 KB
実行使用メモリ 10,220 KB
最終ジャッジ日時 2023-10-20 16:21:25
合計ジャッジ時間 8,182 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,032 KB
testcase_01 AC 26 ms
10,032 KB
testcase_02 AC 24 ms
10,032 KB
testcase_03 AC 26 ms
10,032 KB
testcase_04 AC 152 ms
10,204 KB
testcase_05 AC 109 ms
10,220 KB
testcase_06 AC 111 ms
10,188 KB
testcase_07 AC 132 ms
10,220 KB
testcase_08 AC 148 ms
10,196 KB
testcase_09 AC 522 ms
10,220 KB
testcase_10 AC 380 ms
10,220 KB
testcase_11 AC 1,207 ms
10,220 KB
testcase_12 AC 828 ms
10,220 KB
testcase_13 AC 310 ms
10,220 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, v, c = map(int, input().split())
dp = [-10 ** 9] * (v + 1)
dp[0] = 0
for _ in range(n):
    a, b = map(int, input().split())
    for i in range(a, v + 1)[::-1]:
        dp[i] = max(dp[i], dp[i-a] + b + c)
    for i in range(a, v + 1):
        dp[i] = max(dp[i], dp[i-a] + b)
print(max(dp))
0