結果
問題 | No.710 チーム戦 |
ユーザー |
![]() |
提出日時 | 2019-03-31 22:43:08 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,319 ms / 3,000 ms |
コード長 | 377 bytes |
コンパイル時間 | 88 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 14,336 KB |
最終ジャッジ日時 | 2024-11-22 13:51:45 |
合計ジャッジ時間 | 23,922 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
ソースコード
N = int(input())A_costs, B_costs = zip(*(list(map(int, input().split())) for _ in [0]*N))dp = [sum(B_costs)] * (sum(A_costs)+1)a_acc = 0for a_cost, b_cost in zip(A_costs, B_costs):for i in range(a_acc, -1, -1):if dp[i+a_cost] > dp[i]-b_cost:dp[i+a_cost] = dp[i]-b_costa_acc += a_costprint(min(i if i > v else v for i, v in enumerate(dp)))