結果
| 問題 | No.710 チーム戦 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-29 08:03:49 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 374 bytes |
| 記録 | |
| コンパイル時間 | 271 ms |
| コンパイル使用メモリ | 85,108 KB |
| 実行使用メモリ | 175,824 KB |
| 最終ジャッジ日時 | 2026-03-27 20:20:01 |
| 合計ジャッジ時間 | 4,943 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 2 WA * 23 |
ソースコード
from collections import defaultdict
INF = 1 << 30
n = int(input())
items = [tuple(map(int, input().split())) for _ in range(n)]
s = 0
dp = defaultdict(bool)
dp[0] = True
for i in range(n):
ai, bi = items[i]
s += ai
ndp = defaultdict(bool)
for x, _ in dp.items():
ndp[x] = True
ndp[x + bi - ai] = True
dp = ndp
ans = s + min(list(dp.keys()))
print(ans)