結果
問題 | No.1998 Manhattan Restaurant |
ユーザー |
![]() |
提出日時 | 2022-07-01 23:11:36 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 251 ms / 2,000 ms |
コード長 | 674 bytes |
コンパイル時間 | 485 ms |
コンパイル使用メモリ | 82,276 KB |
実行使用メモリ | 83,620 KB |
最終ジャッジ日時 | 2024-11-26 07:02:53 |
合計ジャッジ時間 | 5,333 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 |
ソースコード
import sys input = sys.stdin.readline N = int(input()) X = [] Y = [] for _ in range(N): x, y = map(int, input().split()) X.append(x + y) Y.append(x - y) xmin = min(X) xmax = max(X) ymin = min(Y) ymax = max(Y) lb, ub = -1, 10**10 while ub - lb > 1: d = (lb + ub) // 2 x1, x2 = xmin+d, xmax-d y1, y2 = ymin+d, ymax-d ok = True for _ in range(2): ok = True for x, y in zip(X, Y): if max(abs(x-x1), abs(y-y1)) > d and max(abs(x-x2), abs(y-y2)) > d: ok = False break if ok: break y1, y2 = y2, y1 if ok: ub = d else: lb = d print(ub)