結果

問題 No.94 圏外です。(EASY)
ユーザー ytftytft
提出日時 2022-11-10 14:55:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 1,077 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 78,596 KB
最終ジャッジ日時 2023-09-30 23:31:18
合計ジャッジ時間 4,153 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,808 KB
testcase_01 AC 71 ms
71,456 KB
testcase_02 AC 70 ms
71,624 KB
testcase_03 AC 72 ms
71,252 KB
testcase_04 AC 79 ms
76,268 KB
testcase_05 AC 81 ms
76,312 KB
testcase_06 AC 86 ms
76,508 KB
testcase_07 AC 94 ms
76,816 KB
testcase_08 AC 107 ms
78,100 KB
testcase_09 AC 123 ms
78,252 KB
testcase_10 AC 129 ms
78,596 KB
testcase_11 AC 126 ms
78,148 KB
testcase_12 AC 118 ms
78,332 KB
testcase_13 AC 118 ms
78,044 KB
testcase_14 AC 138 ms
78,088 KB
testcase_15 AC 127 ms
78,096 KB
testcase_16 AC 131 ms
78,104 KB
testcase_17 AC 130 ms
78,236 KB
testcase_18 AC 124 ms
78,288 KB
testcase_19 AC 116 ms
77,936 KB
testcase_20 AC 71 ms
71,624 KB
testcase_21 AC 69 ms
71,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,math
input=lambda:sys.stdin.readline().rstrip()
class unionFind:
    def __init__(self,N):
        self.N=N
        self.parent=[-1 for i in range(N)]
        self.size=[1 for i in range(N)]
    def find(self,x):
        path=[x]
        while self.parent[path[-1]]!=-1:
            path.append(self.parent[path[-1]])
        for i in path[:-1]:
            self.parent[i]=path[-1]
        return path[-1]
    def unite(self,x,y):
        roots=sorted([self.find(x),self.find(y)],key=lambda _:self.parent[_])
        if roots[0]!=roots[1]:
            self.parent[roots[0]]=roots[1]
            self.size[roots[1]]+=self.size[roots[0]]
def d(A,i,j):
	return (A[i][0]-A[j][0])**2+(A[i][1]-A[j][1])**2
N=int(input())
if N==0:
	print(1)
	sys.exit()
A=[list(map(int,input().split())) for i in range(N)]
u=unionFind(N)
mem={}
ans=0
for i in range(N):
	for j in range(i):
		if d(A,i,j)<=100:
			u.unite(i,j)
for i in range(N):
	if not u.find(i) in mem:
		mem[u.find(i)]=[]
	for j in mem[u.find(i)]:
		ans=max(d(A,i,j),ans)
	mem[u.find(i)].append(i)
print(pow(ans,0.5)+2)
	
0