結果

問題 No.94 圏外です。(EASY)
ユーザー 双六双六
提出日時 2020-08-10 04:44:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 159 ms / 5,000 ms
コード長 1,504 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 77,568 KB
最終ジャッジ日時 2024-04-15 20:30:18
合計ジャッジ時間 3,601 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
54,016 KB
testcase_01 AC 45 ms
54,144 KB
testcase_02 AC 47 ms
54,272 KB
testcase_03 AC 48 ms
53,760 KB
testcase_04 AC 74 ms
67,584 KB
testcase_05 AC 76 ms
72,064 KB
testcase_06 AC 92 ms
76,544 KB
testcase_07 AC 101 ms
77,056 KB
testcase_08 AC 121 ms
76,928 KB
testcase_09 AC 140 ms
77,312 KB
testcase_10 AC 133 ms
77,568 KB
testcase_11 AC 133 ms
77,056 KB
testcase_12 AC 133 ms
77,312 KB
testcase_13 AC 131 ms
77,440 KB
testcase_14 AC 142 ms
77,184 KB
testcase_15 AC 138 ms
77,440 KB
testcase_16 AC 141 ms
77,440 KB
testcase_17 AC 146 ms
76,928 KB
testcase_18 AC 144 ms
76,928 KB
testcase_19 AC 159 ms
76,928 KB
testcase_20 AC 54 ms
55,040 KB
testcase_21 AC 45 ms
53,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

class UnionFind:
	def __init__(self, n):
		self.par = [i for i in range(n + 1)]
		self.rank = [0] * (n + 1)
		self.size = [1] * (n + 1)

	def find(self, x):
		if self.par[x] == x:
			return x
		else:
			self.par[x] = self.find(self.par[x])
			return self.par[x]

	def same_check(self, x, y):
		return self.find(x) == self.find(y)

	def union(self, x, y):
		x = self.find(x); y = self.find(y)
		if self.rank[x] < self.rank[y]:
			if self.same_check(x, y) != True:
				self.size[y] += self.size[x]
				self.size[x] = 0
			self.par[x] = y
		else:
			if self.same_check(x, y) != True:
				self.size[x] += self.size[y]
				self.size[y] = 0
			self.par[y] = x
			if self.rank[x] == self.rank[y]:
				self.rank[x] += 1

	def siz(self, x):
		x = self.find(x)
		return self.size[x]

#処理内容
def main():
	N = int(input())
	path = []
	for i in range(N):
		X, Y = getlist()
		path.append([X, Y])

	UF = UnionFind(N)
	for i in range(N):
		for j in range(i + 1, N):
			x1, y1 = path[i]
			x2, y2 = path[j]
			if (x1 - x2) ** 2 + (y1 - y2) ** 2 <= 100:
				UF.union(i, j)

	ans = 1
	for i in range(N):
		for j in range(N):
			if UF.same_check(i, j):
				x1, y1 = path[i]
				x2, y2 = path[j]
				ans = max(ans, 2 + (((x1 - x2) ** 2) + (y1 - y2) ** 2) ** 0.5)

	print(ans)

if __name__ == '__main__':
	main()
0