結果
問題 | No.545 ママの大事な二人の子供 |
ユーザー | tktk_snsn |
提出日時 | 2020-12-24 00:16:06 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 937 bytes |
コンパイル時間 | 208 ms |
コンパイル使用メモリ | 81,516 KB |
実行使用メモリ | 80,092 KB |
最終ジャッジ日時 | 2023-10-21 15:22:55 |
合計ジャッジ時間 | 6,054 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
53,364 KB |
testcase_01 | AC | 40 ms
53,364 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 37 ms
53,300 KB |
testcase_05 | AC | 37 ms
53,364 KB |
testcase_06 | WA | - |
testcase_07 | AC | 38 ms
53,364 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 36 ms
53,364 KB |
testcase_12 | WA | - |
testcase_13 | AC | 54 ms
63,560 KB |
testcase_14 | AC | 54 ms
66,004 KB |
testcase_15 | WA | - |
testcase_16 | AC | 58 ms
68,140 KB |
testcase_17 | WA | - |
testcase_18 | AC | 110 ms
75,884 KB |
testcase_19 | WA | - |
testcase_20 | AC | 120 ms
76,284 KB |
testcase_21 | AC | 37 ms
53,300 KB |
testcase_22 | AC | 213 ms
77,504 KB |
testcase_23 | WA | - |
testcase_24 | AC | 405 ms
77,300 KB |
testcase_25 | AC | 312 ms
80,084 KB |
testcase_26 | AC | 204 ms
80,092 KB |
testcase_27 | WA | - |
testcase_28 | AC | 408 ms
80,084 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
ソースコード
import bisect from itertools import product n = int(input()) if n == 1: a, b = map(int, input().split()) print(min(a, b)) exit() A = tuple(tuple(map(int, input().split())) for _ in range(n)) def enum(X): res = [] for pair in product(range(2), repeat=len(X)): val = 0 for p, (x, y) in zip(pair, X): if p == 0: val += x else: val -= y res.append(val) return res X = enum(A[:n // 2]) Y = enum(A[n // 2:]) Y.sort() def C(m): for x in X: l = bisect.bisect_left(Y, x - m) r = bisect.bisect_right(Y, x + m) if l != r: return True l = bisect.bisect_left(Y, -x - m) r = bisect.bisect_right(Y, -x + m) if l != r: return True return False l = -1 r = 10 ** 12 while r - l > 1: m = (r + l) // 2 if C(m): r = m else: l = m print(r)