結果
問題 |
No.2232 Miser's Gift
|
ユーザー |
👑 ![]() |
提出日時 | 2023-03-03 21:25:06 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 426 bytes |
コンパイル時間 | 210 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 82,560 KB |
最終ジャッジ日時 | 2024-09-17 22:16:01 |
合計ジャッジ時間 | 7,676 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 WA * 52 |
ソースコード
def solve(): N,W=map(int,input().split()) inf=float("inf") DP=[-inf]*(W+1); DP[0]=0 for i in range(N): w,v=map(int,input().split()) for x in range(W-w,-1,-1): DP[x+w]=max(DP[x+w], DP[x]+v) for x in range(W+1): DP[x]=max(DP[x],0) S=DP[W] return [S+1-DP[W-X] for X in range(1,W+1)] #================================================== print(*solve(),sep="\n")