結果

問題 No.1998 Manhattan Restaurant
ユーザー MasKoaTSMasKoaTS
提出日時 2022-06-02 18:13:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 947 bytes
コンパイル時間 1,233 ms
コンパイル使用メモリ 81,636 KB
実行使用メモリ 81,844 KB
最終ジャッジ日時 2023-10-21 01:15:31
合計ジャッジ時間 4,398 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,480 KB
testcase_01 AC 35 ms
53,480 KB
testcase_02 AC 35 ms
53,480 KB
testcase_03 AC 34 ms
53,480 KB
testcase_04 AC 37 ms
53,480 KB
testcase_05 AC 32 ms
53,480 KB
testcase_06 AC 40 ms
61,448 KB
testcase_07 AC 48 ms
63,616 KB
testcase_08 AC 49 ms
65,672 KB
testcase_09 AC 50 ms
63,612 KB
testcase_10 AC 38 ms
59,260 KB
testcase_11 AC 39 ms
59,332 KB
testcase_12 AC 39 ms
59,260 KB
testcase_13 AC 37 ms
59,260 KB
testcase_14 AC 41 ms
61,388 KB
testcase_15 AC 105 ms
81,844 KB
testcase_16 AC 100 ms
79,700 KB
testcase_17 AC 106 ms
81,704 KB
testcase_18 AC 94 ms
79,712 KB
testcase_19 AC 105 ms
80,292 KB
testcase_20 AC 113 ms
81,844 KB
testcase_21 AC 174 ms
81,824 KB
testcase_22 AC 167 ms
81,824 KB
testcase_23 AC 163 ms
81,824 KB
testcase_24 AC 173 ms
81,824 KB
testcase_25 AC 59 ms
70,716 KB
testcase_26 AC 100 ms
80,276 KB
testcase_27 AC 119 ms
78,788 KB
testcase_28 AC 95 ms
80,288 KB
testcase_29 AC 90 ms
78,196 KB
testcase_30 AC 117 ms
81,764 KB
testcase_31 AC 118 ms
81,708 KB
testcase_32 AC 62 ms
72,784 KB
testcase_33 AC 98 ms
79,956 KB
testcase_34 AC 98 ms
80,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
INF = 10 ** 18

N = int(input())
P = []
for _ in [0] * N:
	x, y = map(int, input().split())
	P.append((x + y, x - y))

max_x = max_y = -INF
min_x = min_y = INF
for x, y in P:
	if(max_x < x):
		max_x = x
	if(max_y < y):
		max_y = y
	if(min_x > x):
		min_x = x
	if(min_y > y):
		min_y = y

def func(k):
	k *= 2
	block = [[0] * 2 for _ in [0] * 2]
	for x, y in P:
		if((x < max_x - k and x > min_x + k) or (y < max_y - k and y > min_y + k)):
			return False
		if(x < max_x - k and y < max_y - k):
			block[0][0] = 1
		if(x > min_x + k and y < max_y - k):
			block[1][0] = 1
		if(x < max_x - k and y > min_y + k):
			block[0][1] = 1
		if(x > min_x + k and y > min_y + k):
			block[1][1] = 1
	if((block[0][0] | block[1][1]) == 0 or (block[0][1] | block[1][0]) == 0):
		return True
	return False

ok = 2 * 10 ** 9 + 1
ng = -1
while(ok - ng > 1):
	k = (ok + ng) // 2
	if(func(k)):
		ok = k
	else:
		ng = k
print(ok)
0