結果
| 問題 |
No.2232 Miser's Gift
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-08-15 12:05:53 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 293 bytes |
| コンパイル時間 | 288 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 17,700 KB |
| 最終ジャッジ日時 | 2024-08-15 12:05:58 |
| 合計ジャッジ時間 | 5,001 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | TLE * 1 -- * 54 |
ソースコード
N,W=map(int,input().split())
inf=1<<60
dp=[-inf]*(W+1)
dp[0]=0
for n in range(N):
w,v=map(int,input().split())
for s in range(W,w-1,-1):
dp[s]=max(dp[s],dp[s-w]+v)
for w in range(1,W+1):
dp[w]=max(dp[w],dp[w-1])
for X in range(1,W+1):
ans=dp[W]-dp[W-X]+1
print(ans)
vwxyz