結果
問題 | No.168 ものさし |
ユーザー | rlangevin |
提出日時 | 2023-07-04 12:26:53 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,351 bytes |
コンパイル時間 | 296 ms |
コンパイル使用メモリ | 87,208 KB |
実行使用メモリ | 78,856 KB |
最終ジャッジ日時 | 2023-09-25 10:22:15 |
合計ジャッジ時間 | 5,346 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 178 ms
78,144 KB |
testcase_01 | AC | 75 ms
71,384 KB |
testcase_02 | AC | 70 ms
71,288 KB |
testcase_03 | AC | 72 ms
71,216 KB |
testcase_04 | AC | 71 ms
71,348 KB |
testcase_05 | AC | 71 ms
71,116 KB |
testcase_06 | AC | 77 ms
75,640 KB |
testcase_07 | WA | - |
testcase_08 | AC | 71 ms
71,364 KB |
testcase_09 | AC | 113 ms
77,536 KB |
testcase_10 | AC | 133 ms
77,416 KB |
testcase_11 | AC | 173 ms
78,120 KB |
testcase_12 | AC | 250 ms
78,164 KB |
testcase_13 | AC | 306 ms
78,596 KB |
testcase_14 | AC | 290 ms
78,796 KB |
testcase_15 | AC | 72 ms
71,120 KB |
testcase_16 | AC | 117 ms
77,592 KB |
testcase_17 | AC | 125 ms
77,572 KB |
testcase_18 | AC | 135 ms
77,532 KB |
testcase_19 | AC | 266 ms
78,764 KB |
testcase_20 | AC | 262 ms
78,352 KB |
testcase_21 | AC | 277 ms
78,564 KB |
testcase_22 | AC | 276 ms
78,856 KB |
ソースコード
import sys input = sys.stdin.readline class UnionFind(object): def __init__(self, n=1): self.par = [i for i in range(n)] self.rank = [0 for _ in range(n)] self.size = [1 for _ in range(n)] def find(self, x): if self.par[x] == x: return x else: self.par[x] = self.find(self.par[x]) return self.par[x] def union(self, x, y): x = self.find(x) y = self.find(y) if x != y: if self.rank[x] < self.rank[y]: x, y = y, x if self.rank[x] == self.rank[y]: self.rank[x] += 1 self.par[y] = x self.size[x] += self.size[y] def is_same(self, x, y): return self.find(x) == self.find(y) def get_size(self, x): x = self.find(x) return self.size[x] N = int(input()) X, Y = [0] * N, [0] * N for i in range(N): X[i], Y[i] = map(int, input().split()) yes = 10 ** 9 + 5 no = -1 def check(m): U = UnionFind(N) for i in range(N): for j in range(i + 1, N): if (X[i] - X[j]) ** 2 + (Y[i] - Y[j]) ** 2 <= m ** 2: U.union(i, j) return U.is_same(0, N - 1) while yes - no != 1: mid = (yes + no)//2 if check(mid): yes = mid else: no = mid print((yes + 9)//10*10)