結果
問題 | No.168 ものさし |
ユーザー | 双六 |
提出日時 | 2020-07-27 02:06:02 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,209 bytes |
コンパイル時間 | 900 ms |
コンパイル使用メモリ | 86,900 KB |
実行使用メモリ | 139,588 KB |
最終ジャッジ日時 | 2023-09-11 05:32:08 |
合計ジャッジ時間 | 17,793 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 424 ms
95,580 KB |
testcase_01 | WA | - |
testcase_02 | AC | 98 ms
72,076 KB |
testcase_03 | AC | 99 ms
71,856 KB |
testcase_04 | AC | 99 ms
71,936 KB |
testcase_05 | AC | 98 ms
72,096 KB |
testcase_06 | AC | 97 ms
71,736 KB |
testcase_07 | AC | 96 ms
71,896 KB |
testcase_08 | AC | 96 ms
71,964 KB |
testcase_09 | AC | 110 ms
77,300 KB |
testcase_10 | AC | 130 ms
77,156 KB |
testcase_11 | AC | 383 ms
93,804 KB |
testcase_12 | AC | 1,314 ms
123,940 KB |
testcase_13 | AC | 1,955 ms
139,528 KB |
testcase_14 | AC | 1,945 ms
139,512 KB |
testcase_15 | AC | 99 ms
71,932 KB |
testcase_16 | AC | 109 ms
77,192 KB |
testcase_17 | AC | 122 ms
77,516 KB |
testcase_18 | AC | 161 ms
78,400 KB |
testcase_19 | AC | 1,868 ms
139,456 KB |
testcase_20 | AC | 1,954 ms
139,488 KB |
testcase_21 | AC | 1,959 ms
139,376 KB |
testcase_22 | AC | 1,939 ms
139,588 KB |
ソースコード
import sys; input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) class UnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0] * (n + 1) 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 same_check(self, x, y): return self.find(x) == self.find(y) def union(self, x, y): x = self.find(x); y = self.find(y) if self.rank[x] < self.rank[y]: self.par[x] = y else: self.par[y] = x if self.rank[x] == self.rank[y]: self.rank[x] += 1 #処理内容 def main(): N = int(input()) UF = UnionFind(N) node = [] edge = [] for i in range(N): X, Y = getlist() node.append([X, Y]) for i in range(N): for j in range(i + 1, N): x1, y1 = node[i] x2, y2 = node[j] edge.append([((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 + 9.99999999, i, j]) edge.sort() ans = INF for dist, i, j in edge: UF.union(i, j) if UF.same_check(0, N - 1): ans = int(dist // 10) * 10 break print(ans) if __name__ == '__main__': main()