結果
問題 |
No.771 しおり
|
ユーザー |
|
提出日時 | 2018-12-25 23:43:17 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 449 bytes |
コンパイル時間 | 121 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 24,504 KB |
最終ジャッジ日時 | 2024-10-01 14:37:40 |
合計ジャッジ時間 | 6,719 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | TLE * 1 -- * 42 |
ソースコード
ans = 2000 n = int(input()) A = [] for _ in range(n): a, b = map(int, input().split()) A.append((a, b, b - a)) def f(num, l, max_A): global ans if max_A >= ans: return if l == 0: ans = max_A return for i in range(n): if (1 << i) & l: max_A = max(max_A, A[num][2] + A[i][0]) f(i, l - (1 << i), max_A) for i in range(n): f(i, ((1 << n) - 1) - (1 << i), 0) print(ans)