結果
問題 | No.94 圏外です。(EASY) |
ユーザー | chocorusk |
提出日時 | 2020-09-12 10:32:26 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 848 ms / 5,000 ms |
コード長 | 1,192 bytes |
コンパイル時間 | 186 ms |
コンパイル使用メモリ | 11,100 KB |
実行使用メモリ | 8,700 KB |
最終ジャッジ日時 | 2023-08-30 03:00:03 |
合計ジャッジ時間 | 10,217 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
8,412 KB |
testcase_01 | AC | 17 ms
8,540 KB |
testcase_02 | AC | 17 ms
8,468 KB |
testcase_03 | AC | 17 ms
8,468 KB |
testcase_04 | AC | 31 ms
8,576 KB |
testcase_05 | AC | 53 ms
8,428 KB |
testcase_06 | AC | 107 ms
8,432 KB |
testcase_07 | AC | 217 ms
8,520 KB |
testcase_08 | AC | 426 ms
8,524 KB |
testcase_09 | AC | 702 ms
8,552 KB |
testcase_10 | AC | 771 ms
8,684 KB |
testcase_11 | AC | 848 ms
8,504 KB |
testcase_12 | AC | 654 ms
8,504 KB |
testcase_13 | AC | 777 ms
8,700 KB |
testcase_14 | AC | 766 ms
8,508 KB |
testcase_15 | AC | 705 ms
8,508 KB |
testcase_16 | AC | 673 ms
8,664 KB |
testcase_17 | AC | 670 ms
8,668 KB |
testcase_18 | AC | 673 ms
8,580 KB |
testcase_19 | AC | 594 ms
8,668 KB |
testcase_20 | AC | 17 ms
8,432 KB |
testcase_21 | AC | 16 ms
8,616 KB |
ソースコード
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() xy=list(map(int, read().split())) x=xy[::2] y=xy[1::2] import itertools uf=UnionFind(n) for i, j in itertools.combinations(range(n), 2): if (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])<=100: uf.unite(i, j) mx=0 for i, j in itertools.combinations(range(n), 2): d=(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]) if mx<d and uf.same(i, j): mx=d import math print('{:.7f}'.format(2.0+math.sqrt(mx)))