結果

問題 No.1947 質より種類数
ユーザー titiatitia
提出日時 2022-05-20 22:20:24
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 482 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 81,628 KB
実行使用メモリ 73,468 KB
最終ジャッジ日時 2023-10-20 13:04:36
合計ジャッジ時間 6,025 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,352 KB
testcase_01 AC 35 ms
53,352 KB
testcase_02 AC 36 ms
53,352 KB
testcase_03 AC 37 ms
53,352 KB
testcase_04 AC 56 ms
66,100 KB
testcase_05 AC 51 ms
64,048 KB
testcase_06 AC 57 ms
66,132 KB
testcase_07 AC 53 ms
66,092 KB
testcase_08 AC 58 ms
66,096 KB
testcase_09 AC 62 ms
66,100 KB
testcase_10 AC 60 ms
66,100 KB
testcase_11 AC 74 ms
66,376 KB
testcase_12 AC 72 ms
66,100 KB
testcase_13 AC 58 ms
66,100 KB
testcase_14 AC 149 ms
70,736 KB
testcase_15 AC 101 ms
70,568 KB
testcase_16 AC 239 ms
72,784 KB
testcase_17 AC 171 ms
72,784 KB
testcase_18 AC 482 ms
73,468 KB
testcase_19 AC 295 ms
72,816 KB
testcase_20 AC 210 ms
72,768 KB
testcase_21 AC 346 ms
72,764 KB
testcase_22 AC 62 ms
66,312 KB
testcase_23 AC 162 ms
70,720 KB
testcase_24 AC 55 ms
64,036 KB
testcase_25 AC 54 ms
63,972 KB
testcase_26 AC 51 ms
63,956 KB
testcase_27 AC 53 ms
63,956 KB
testcase_28 AC 58 ms
66,040 KB
testcase_29 AC 339 ms
72,720 KB
testcase_30 AC 218 ms
72,732 KB
testcase_31 AC 37 ms
53,352 KB
testcase_32 AC 37 ms
53,352 KB
testcase_33 AC 47 ms
61,888 KB
testcase_34 AC 338 ms
72,736 KB
testcase_35 AC 131 ms
68,556 KB
testcase_36 AC 214 ms
72,732 KB
権限があれば一括ダウンロードができます

ソースコード

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