結果

問題 No.1997 X Lighting
ユーザー MasKoaTSMasKoaTS
提出日時 2022-02-21 16:51:06
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 947 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 67,404 KB
最終ジャッジ日時 2024-04-28 11:59:59
合計ジャッジ時間 3,138 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

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