結果

問題 No.1947 質より種類数
ユーザー titiatitia
提出日時 2022-05-20 22:20:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 339 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 12,036 KB
実行使用メモリ 14,872 KB
最終ジャッジ日時 2023-10-20 13:04:16
合計ジャッジ時間 9,065 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
14,528 KB
testcase_01 AC 29 ms
10,088 KB
testcase_02 AC 28 ms
10,088 KB
testcase_03 AC 29 ms
10,088 KB
testcase_04 AC 173 ms
10,264 KB
testcase_05 AC 129 ms
10,280 KB
testcase_06 AC 132 ms
10,244 KB
testcase_07 AC 156 ms
10,280 KB
testcase_08 AC 175 ms
10,256 KB
testcase_09 AC 657 ms
10,288 KB
testcase_10 AC 458 ms
10,288 KB
testcase_11 AC 1,413 ms
10,304 KB
testcase_12 AC 987 ms
10,292 KB
testcase_13 AC 365 ms
10,288 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 #

import sys
input = sys.stdin.readline

N,V,C=map(int,input().split())
AB=[tuple(map(int,input().split())) for i in range(N)]

DP=[0]*(V+1)

for a,b in AB:
    for i in range(V,-1,-1):
        if i>=a:
            DP[i]=max(DP[i],DP[i-a]+b+C)

    for i in range(V+1):
        if i>=a:
            DP[i]=max(DP[i],DP[i-a]+b)

print(max(DP))
0