結果
問題 | No.1998 Manhattan Restaurant |
ユーザー | 👑 rin204 |
提出日時 | 2022-07-01 22:32:08 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,068 bytes |
コンパイル時間 | 231 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 108,744 KB |
最終ジャッジ日時 | 2024-05-04 16:50:49 |
合計ジャッジ時間 | 11,995 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
52,352 KB |
testcase_01 | AC | 44 ms
52,224 KB |
testcase_02 | AC | 34 ms
52,992 KB |
testcase_03 | AC | 36 ms
52,352 KB |
testcase_04 | AC | 40 ms
52,992 KB |
testcase_05 | AC | 36 ms
53,120 KB |
testcase_06 | AC | 52 ms
64,896 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 56 ms
63,872 KB |
testcase_11 | AC | 47 ms
60,800 KB |
testcase_12 | AC | 41 ms
53,888 KB |
testcase_13 | AC | 42 ms
54,656 KB |
testcase_14 | AC | 59 ms
65,792 KB |
testcase_15 | AC | 728 ms
108,744 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 723 ms
107,932 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
ソースコード
n = int(input()) if n <= 2: print(0) exit() xy = [] for _ in range(n): x, y = map(int, input().split()) xy.append((x + y, x - y)) xy.sort(key=lambda x:(x[0], x[1])) inf = 1 << 40 mi_y = inf ma_y = -inf X = [0] * (n - 1) for i in range(n - 1): mi_y = min(mi_y, xy[i][1]) ma_y = max(ma_y, xy[i][1]) dy = (ma_y - mi_y) dx = xy[i][0] - xy[0][0] X[i] = max(dx, dy) mi_y = inf ma_y = -inf for i in range(n - 1, 0, -1): mi_y = min(mi_y, xy[i][1]) ma_y = max(ma_y, xy[i][1]) dy = (ma_y - mi_y) dx = xy[-1][0] - xy[i][0] X[i - 1] = max(X[i - 1], dx, dy) ans = min(X) xy.sort(key=lambda x:(x[0], -x[1])) inf = 1 << 40 mi_y = inf ma_y = -inf X = [0] * (n - 1) for i in range(n - 1): mi_y = min(mi_y, xy[i][1]) ma_y = max(ma_y, xy[i][1]) dy = (ma_y - mi_y) dx = xy[i][0] - xy[0][0] X[i] = max(dx, dy) mi_y = inf ma_y = -inf for i in range(n - 1, 0, -1): mi_y = min(mi_y, xy[i][1]) ma_y = max(ma_y, xy[i][1]) dy = (ma_y - mi_y) dx = xy[-1][0] - xy[i][0] X[i - 1] = max(X[i - 1], dx, dy) ans = min(ans, *X) xy.sort(key=lambda x:(x[1], x[0])) inf = 1 << 40 mi_y = inf ma_y = -inf X = [0] * (n - 1) for i in range(n - 1): mi_y = min(mi_y, xy[i][0]) ma_y = max(ma_y, xy[i][0]) dy = (ma_y - mi_y) dx = xy[i][1] - xy[0][1] X[i] = max(dx, dy) mi_y = inf ma_y = -inf for i in range(n - 1, 0, -1): mi_y = min(mi_y, xy[i][0]) ma_y = max(ma_y, xy[i][0]) dy = (ma_y - mi_y) dx = xy[-1][1] - xy[i][1] X[i - 1] = max(X[i - 1], dx, dy) ans = min(ans, *X) xy.sort(key=lambda x:(x[1], -x[0])) inf = 1 << 40 mi_y = inf ma_y = -inf X = [0] * (n - 1) for i in range(n - 1): mi_y = min(mi_y, xy[i][0]) ma_y = max(ma_y, xy[i][0]) dy = (ma_y - mi_y) dx = xy[i][1] - xy[0][1] X[i] = max(dx, dy) mi_y = inf ma_y = -inf for i in range(n - 1, 0, -1): mi_y = min(mi_y, xy[i][0]) ma_y = max(ma_y, xy[i][0]) dy = (ma_y - mi_y) dx = xy[-1][1] - xy[i][1] X[i - 1] = max(X[i - 1], dx, dy) ans = min(ans, *X) print(ans // 2)