結果

問題 No.94 圏外です。(EASY)
ユーザー chocoruskchocorusk
提出日時 2020-09-12 10:39:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 629 ms / 5,000 ms
コード長 1,208 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 8,616 KB
最終ジャッジ日時 2023-08-30 03:08:07
合計ジャッジ時間 8,567 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,360 KB
testcase_01 AC 17 ms
8,352 KB
testcase_02 AC 17 ms
8,324 KB
testcase_03 AC 16 ms
8,468 KB
testcase_04 AC 27 ms
8,332 KB
testcase_05 AC 45 ms
8,332 KB
testcase_06 AC 90 ms
8,472 KB
testcase_07 AC 184 ms
8,376 KB
testcase_08 AC 348 ms
8,420 KB
testcase_09 AC 574 ms
8,192 KB
testcase_10 AC 554 ms
8,580 KB
testcase_11 AC 629 ms
8,436 KB
testcase_12 AC 554 ms
8,432 KB
testcase_13 AC 566 ms
8,616 KB
testcase_14 AC 553 ms
8,572 KB
testcase_15 AC 578 ms
8,480 KB
testcase_16 AC 563 ms
8,484 KB
testcase_17 AC 546 ms
8,612 KB
testcase_18 AC 557 ms
8,528 KB
testcase_19 AC 499 ms
8,536 KB
testcase_20 AC 17 ms
8,380 KB
testcase_21 AC 17 ms
8,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)))
0