結果
問題 |
No.710 チーム戦
|
ユーザー |
|
提出日時 | 2022-10-29 08:03:49 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 374 bytes |
コンパイル時間 | 351 ms |
コンパイル使用メモリ | 82,388 KB |
実行使用メモリ | 157,116 KB |
最終ジャッジ日時 | 2024-07-06 08:39:18 |
合計ジャッジ時間 | 5,690 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)