結果

問題 No.1998 Manhattan Restaurant
ユーザー MasKoaTSMasKoaTS
提出日時 2022-03-24 13:49:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 248 ms / 2,000 ms
コード長 980 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 81,788 KB
最終ジャッジ日時 2023-10-21 01:15:01
合計ジャッジ時間 4,544 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,480 KB
testcase_01 AC 35 ms
53,480 KB
testcase_02 AC 34 ms
53,480 KB
testcase_03 AC 33 ms
53,480 KB
testcase_04 AC 35 ms
53,480 KB
testcase_05 AC 37 ms
53,480 KB
testcase_06 AC 41 ms
59,124 KB
testcase_07 AC 49 ms
63,468 KB
testcase_08 AC 48 ms
63,468 KB
testcase_09 AC 49 ms
63,468 KB
testcase_10 AC 40 ms
59,124 KB
testcase_11 AC 45 ms
59,196 KB
testcase_12 AC 40 ms
59,124 KB
testcase_13 AC 40 ms
59,124 KB
testcase_14 AC 44 ms
61,252 KB
testcase_15 AC 106 ms
81,788 KB
testcase_16 AC 86 ms
79,008 KB
testcase_17 AC 95 ms
81,660 KB
testcase_18 AC 88 ms
79,024 KB
testcase_19 AC 89 ms
79,580 KB
testcase_20 AC 111 ms
81,788 KB
testcase_21 AC 236 ms
81,780 KB
testcase_22 AC 243 ms
81,780 KB
testcase_23 AC 234 ms
81,784 KB
testcase_24 AC 248 ms
81,780 KB
testcase_25 AC 57 ms
68,504 KB
testcase_26 AC 94 ms
79,568 KB
testcase_27 AC 79 ms
78,056 KB
testcase_28 AC 90 ms
79,576 KB
testcase_29 AC 80 ms
78,068 KB
testcase_30 AC 104 ms
81,712 KB
testcase_31 AC 99 ms
81,656 KB
testcase_32 AC 57 ms
70,564 KB
testcase_33 AC 91 ms
79,016 KB
testcase_34 AC 95 ms
80,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def main():
	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

	ok = 2 * 10 ** 9 + 1
	ng = -1
	while(ok - ng > 1):
		k = ok + ng
		f = False
		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)):
				break
			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
		else:
			if((block[0][0] | block[1][1]) == 0 or (block[0][1] | block[1][0]) == 0):
				f = True
		if(f):
			ok = k // 2
		else:
			ng = k // 2
	print(ok)

main()
0