結果
| 問題 |
No.710 チーム戦
|
| コンテスト | |
| ユーザー |
htkb
|
| 提出日時 | 2019-03-31 22:43:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,285 ms / 3,000 ms |
| コード長 | 377 bytes |
| コンパイル時間 | 270 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 14,592 KB |
| 最終ジャッジ日時 | 2024-11-22 13:52:43 |
| 合計ジャッジ時間 | 23,476 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 = 0
for 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_cost
a_acc += a_cost
print(min(i if i > v else v for i, v in enumerate(dp)))
htkb