結果
| 問題 | No.2232 Miser's Gift |
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-08-15 12:05:53 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 293 bytes |
| 記録 | |
| コンパイル時間 | 442 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 26,452 KB |
| 最終ジャッジ日時 | 2026-04-03 21:20:28 |
| 合計ジャッジ時間 | 8,971 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 TLE * 31 |
ソースコード
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