結果
| 問題 |
No.94 圏外です。(EASY)
|
| コンテスト | |
| ユーザー |
chocorusk
|
| 提出日時 | 2020-09-12 10:39:03 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 769 ms / 5,000 ms |
| コード長 | 1,208 bytes |
| コンパイル時間 | 286 ms |
| コンパイル使用メモリ | 12,928 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2024-12-31 09:40:52 |
| 合計ジャッジ時間 | 9,962 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines
class UnionFind:
def __init__(self, n):
self.n=n
self.par=[-1]*n
def find(self, x):
if self.par[x]<0:
return x
self.par[x]=self.find(self.par[x])
return self.par[x]
def unite(self, x, y):
x=self.find(x)
y=self.find(y)
if x==y:
return False
if self.par[x]<self.par[y]:
x, y=y, x
self.par[y]+=self.par[x]
self.par[x]=y
return True
def same(self, x, y):
return self.find(x)==self.find(y)
def size(self, x):
return -self.par[self.find(x)]
n=int(readline())
if n==0:
print(1)
exit()
m=map(int, read().split())
xy=list(zip(m, m))
uf=UnionFind(n)
for i, (xi, yi) in enumerate(xy):
for j, (xj, yj) in enumerate(xy[:i]):
if (xi-xj)*(xi-xj)+(yi-yj)*(yi-yj)<=100:
uf.unite(i, j)
mx=0
for i, (xi, yi) in enumerate(xy):
for j, (xj, yj) in enumerate(xy[:i]):
d=(xi-xj)*(xi-xj)+(yi-yj)*(yi-yj)
if mx<d and uf.same(i, j):
mx=d
import math
print('{:.7f}'.format(2.0+math.sqrt(mx)))
chocorusk