結果

問題 No.1947 質より種類数
ユーザー ああいい
提出日時 2022-05-20 23:53:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 400 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,268 KB
実行使用メモリ 78,148 KB
最終ジャッジ日時 2024-09-20 10:20:12
合計ジャッジ時間 8,342 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 19
権限があれば一括ダウンロードができます

ソースコード

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