結果
問題 | No.710 チーム戦 |
ユーザー |
![]() |
提出日時 | 2018-07-16 02:07:18 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 30 ms / 3,000 ms |
コード長 | 549 bytes |
コンパイル時間 | 3,179 ms |
コンパイル使用メモリ | 66,784 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 03:12:13 |
合計ジャッジ時間 | 4,671 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
ソースコード
import strutils, sequtils, algorithmvarn=stdin.readLine.parseIntdp=newSeq[int](1000*100+1)# dp[t]:=sum_{i in I}(A_i)=tを満たすIに対して、max_{I}(\sum_{i in I}(B_i))sb=0fill(dp, -1)dp[0]=0for _ in 0..<n:varargs=stdin.readLine.split.map(parseInt)(a, b)=(args[0], args[1])sb+=bfor t in countdown(1000*100, 0):if dp[t]<0:continueif t+a<dp.len:dp[t+a]=max(dp[t+a], dp[t]+b)var mn=1_000_000_000for t in 0..1000*100:if dp[t]<0:continuemn=min(mn, max(t, sb-dp[t]))echo mn