結果

問題 No.1947 質より種類数
ユーザー 👑 H20H20
提出日時 2022-03-26 19:14:06
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 613 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 78,704 KB
最終ジャッジ日時 2023-08-23 06:29:49
合計ジャッジ時間 9,426 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,348 KB
testcase_01 AC 73 ms
71,548 KB
testcase_02 AC 72 ms
71,300 KB
testcase_03 AC 72 ms
71,556 KB
testcase_04 AC 91 ms
76,152 KB
testcase_05 AC 90 ms
76,440 KB
testcase_06 AC 89 ms
76,364 KB
testcase_07 AC 93 ms
76,344 KB
testcase_08 AC 89 ms
76,480 KB
testcase_09 AC 101 ms
77,124 KB
testcase_10 AC 97 ms
76,344 KB
testcase_11 AC 121 ms
77,176 KB
testcase_12 AC 109 ms
76,900 KB
testcase_13 AC 95 ms
76,296 KB
testcase_14 AC 261 ms
78,296 KB
testcase_15 AC 177 ms
77,464 KB
testcase_16 AC 325 ms
78,268 KB
testcase_17 AC 396 ms
78,576 KB
testcase_18 AC 613 ms
78,516 KB
testcase_19 AC 551 ms
78,564 KB
testcase_20 AC 440 ms
78,384 KB
testcase_21 AC 502 ms
78,704 KB
testcase_22 AC 115 ms
77,312 KB
testcase_23 AC 287 ms
78,120 KB
testcase_24 AC 92 ms
76,564 KB
testcase_25 AC 88 ms
76,364 KB
testcase_26 AC 84 ms
76,124 KB
testcase_27 AC 86 ms
76,316 KB
testcase_28 AC 89 ms
76,308 KB
testcase_29 AC 418 ms
78,204 KB
testcase_30 AC 499 ms
78,136 KB
testcase_31 AC 70 ms
71,464 KB
testcase_32 AC 71 ms
71,340 KB
testcase_33 AC 81 ms
76,520 KB
testcase_34 AC 424 ms
78,372 KB
testcase_35 AC 286 ms
78,272 KB
testcase_36 AC 506 ms
78,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,V,C = map(int, input().split())
VW = [list(map(int, input().split())) for _ in range(N)]
DP = [0]*(V+1)
for v,w in VW:
    w+=C
    for i in reversed(range(V)):
        if DP[i]>0 and i+v<=V and DP[i+v]<DP[i]+w:
            DP[i+v]=DP[i]+w
    if v<=V and DP[v]<w:
        DP[v]=w
for v,w in VW:
    for i in range(V):
        if DP[i]>0 and i+v<=V and DP[i+v]<DP[i]+w:
            DP[i+v]=DP[i]+w
print(max(DP))
0