結果

問題 No.168 ものさし
ユーザー chocoruskchocorusk
提出日時 2020-09-14 09:23:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,117 ms / 2,000 ms
コード長 1,145 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 10,868 KB
実行使用メモリ 69,992 KB
最終ジャッジ日時 2023-09-04 00:32:12
合計ジャッジ時間 9,897 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 194 ms
22,284 KB
testcase_01 AC 16 ms
8,396 KB
testcase_02 AC 16 ms
8,312 KB
testcase_03 AC 17 ms
8,420 KB
testcase_04 AC 17 ms
8,344 KB
testcase_05 AC 17 ms
8,336 KB
testcase_06 AC 17 ms
8,352 KB
testcase_07 AC 16 ms
8,380 KB
testcase_08 AC 17 ms
8,468 KB
testcase_09 AC 21 ms
8,796 KB
testcase_10 AC 32 ms
9,868 KB
testcase_11 AC 179 ms
20,232 KB
testcase_12 AC 732 ms
49,392 KB
testcase_13 AC 1,117 ms
66,740 KB
testcase_14 AC 1,096 ms
67,584 KB
testcase_15 AC 17 ms
8,400 KB
testcase_16 AC 19 ms
8,692 KB
testcase_17 AC 24 ms
9,124 KB
testcase_18 AC 47 ms
11,444 KB
testcase_19 AC 988 ms
67,584 KB
testcase_20 AC 1,019 ms
69,544 KB
testcase_21 AC 1,012 ms
69,992 KB
testcase_22 AC 1,033 ms
69,672 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())
xy=list(map(int, read().split()))
x=xy[::2]
y=xy[1::2]
import itertools
es=[((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]), i, j) for i, j in itertools.combinations(range(n), 2)]
es.sort()
uf=UnionFind(n)
mn=0
for e in es:
    uf.unite(e[1], e[2])
    if uf.same(0, n-1):
        mn=e[0]
        break
l, r=0, 2*10**8
while r-l>1:
    m=(l+r)//2
    if 100*m*m>=mn:
        r=m
    else:
        l=m
print(10*r)
0