結果
問題 | No.94 圏外です。(EASY) |
ユーザー |
![]() |
提出日時 | 2019-09-07 16:50:34 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 132 ms / 5,000 ms |
コード長 | 1,169 bytes |
コンパイル時間 | 248 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 77,168 KB |
最終ジャッジ日時 | 2024-06-26 21:56:30 |
合計ジャッジ時間 | 3,061 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
n = int(input())xy = [list(map(int, input().split())) for i in range(n)]ans=0if n==0:print(1)exit()class UnionFind:__slots__ = ['id']def __init__(self, n):self.id = [-1] * ndef root(self, x):if self.id[x] < 0:return xelse:self.id[x] = self.root(self.id[x])return self.id[x]def find(self, x, y):return self.root(x) == self.root(y)def union(self, x, y):s1, s2 = self.root(x), self.root(y)if s1 != s2:if self.id[s1] <= self.id[s2]:self.id[s1] += self.id[s2]self.id[s2] = s1else:self.id[s2] += self.id[s1]self.id[s1] = s2return Truereturn Falseuf =UnionFind(n)for i in range(n):for j in range(n):x1, y1 = xy[i]x2, y2 = xy[j]if (x1-x2)**2+(y1-y2)**2<=100:uf.union(i,j)for i in range(n):for j in range(n):if uf.find(i,j):x1,y1=xy[i]x2,y2=xy[j]ans=max(ans,(x1-x2)**2+(y1-y2)**2)print(ans**(0.5)+2)