結果
問題 |
No.2232 Miser's Gift
|
ユーザー |
|
提出日時 | 2023-03-03 21:54:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 148 ms / 2,000 ms |
コード長 | 297 bytes |
コンパイル時間 | 171 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 77,208 KB |
最終ジャッジ日時 | 2024-09-17 22:51:21 |
合計ジャッジ時間 | 7,525 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 55 |
ソースコード
n,W = map(int,input().split()) WV = [list(map(int,input().split())) for i in range(n)] dp = [0]*(W+1) for w,v in WV: for i in range(W)[::-1]: if i+w <= W and dp[i+w] < dp[i]+v: dp[i+w] = dp[i]+v base = dp[-1] for i in range(W)[::-1]: num = dp[i] print(base-num+1)