結果
問題 | No.1037 exhausted |
ユーザー | vwxyz |
提出日時 | 2024-08-14 21:02:55 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 179 ms / 2,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 231 ms |
コンパイル使用メモリ | 82,364 KB |
実行使用メモリ | 76,720 KB |
最終ジャッジ日時 | 2024-08-14 21:02:59 |
合計ジャッジ時間 | 3,343 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
N,V,L=map(int,input().split()) inf=1<<60 dp=[inf]*(V+1) dp[V]=0 cur=0 for i in range(N): x,v,w=map(int,input().split()) prev=dp dp=[inf]*(V+1) for c in range(x-cur,V+1): dp[c-(x-cur)]=prev[c] prev=dp dp=[inf]*(V+1) for c in range(V+1): dp[c]=min(dp[c],prev[c]) dp[min(c+v,V)]=min(dp[min(c+v,V)],prev[c]+w) cur=x ans=inf for v in range(V+1): if v>=L-cur: ans=min(ans,dp[v]) if ans==inf: ans=-1 print(ans)