結果

問題 No.1947 質より種類数
ユーザー ああいいああいい
提出日時 2022-05-20 23:53:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 1,658 ms
コンパイル使用メモリ 81,120 KB
実行使用メモリ 77,340 KB
最終ジャッジ日時 2023-10-20 14:51:00
合計ジャッジ時間 9,528 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,240 KB
testcase_01 WA -
testcase_02 AC 41 ms
55,240 KB
testcase_03 AC 40 ms
53,192 KB
testcase_04 AC 129 ms
72,392 KB
testcase_05 AC 127 ms
70,348 KB
testcase_06 AC 184 ms
70,344 KB
testcase_07 AC 234 ms
72,396 KB
testcase_08 AC 140 ms
72,392 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 336 ms
76,320 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 126 ms
75,884 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 141 ms
68,356 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 147 ms
68,356 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 40 ms
53,252 KB
testcase_32 AC 41 ms
53,252 KB
testcase_33 AC 160 ms
66,316 KB
testcase_34 AC 338 ms
76,484 KB
testcase_35 AC 71 ms
72,976 KB
testcase_36 AC 127 ms
74,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,V,C = map(int,input().split())

from collections import defaultdict
d = defaultdict(int)
for _ in range(N):
    v,w = map(int,input().split())
    d[v] = max(d[v],w)
dp = [0] * (V + 1)
for v,w in d.items():
    nx = dp.copy()
    for i in range(V + 1):
        for j in range(1,(V - i) // v + 1):
            nx[i + j * v] = max(nx[i + j * v],dp[i] + C + w * j)
        
    dp = nx
print(max(dp))
0