結果
| 問題 | 
                            No.94 圏外です。(EASY)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-11-16 10:52:31 | 
| 言語 | Python2  (2.7.18)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2,183 ms / 5,000 ms | 
| コード長 | 1,008 bytes | 
| コンパイル時間 | 387 ms | 
| コンパイル使用メモリ | 7,040 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-24 23:18:18 | 
| 合計ジャッジ時間 | 18,953 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
ソースコード
#yuki94
import sys
class Unionfind:
 def __init__(self,N):
  self.par=[-1]*N
    
 def root(self,x):
  if self.par[x]<0:
   return x
        
  self.par[x]=self.root(self.par[x])
  return self.par[x]
    
 def find(self,x,y):
  return self.root(x)==self.root(y)
 def unite(self,x,y):
  rx,ry=self.root(x),self.root(y)
        
  if rx!=ry:
   rx_num,ry_num=-self.par[rx],-self.par[ry]
            
   if rx_num>ry_num or (rx_num==ry_num and rx<ry):
    self.par[rx]+=self.par[ry]
    self.par[ry]=rx
   elif ry_num>rx_num or (rx_num==ry_num and ry<rx):
    self.par[ry]+=self.par[rx]
    self.par[rx]=ry
n=int(raw_input())
if n==0:
 print 1
 sys.exit()
uf=Unionfind(n)
l=[]
for i in range(n):
 l.append(map(int,raw_input().split()))
for i in range(n):
 for j in range(n):
  x1,y1=l[i]
  x2,y2=l[j]
  if (x1-x2)**2+(y1-y2)**2<=100:
   uf.unite(i,j)
res=0
for i in range(n):
 for j in range(n):
  if uf.find(i,j):
   x1,y1=l[i]
   x2,y2=l[j]
   res=max(res,(x1-x2)**2+(y1-y2)**2)
print 1.0*res**0.5+2