結果
問題 | No.1639 最小通信路 |
ユーザー | tcltk |
提出日時 | 2021-10-18 03:22:42 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,765 bytes |
コンパイル時間 | 128 ms |
コンパイル使用メモリ | 82,172 KB |
実行使用メモリ | 90,428 KB |
最終ジャッジ日時 | 2024-09-18 19:09:16 |
合計ジャッジ時間 | 7,847 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 109 ms
86,568 KB |
testcase_01 | AC | 120 ms
86,100 KB |
testcase_02 | AC | 179 ms
90,428 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 154 ms
89,560 KB |
testcase_06 | AC | 154 ms
89,692 KB |
testcase_07 | AC | 112 ms
86,496 KB |
testcase_08 | AC | 174 ms
89,936 KB |
testcase_09 | AC | 124 ms
88,912 KB |
testcase_10 | AC | 135 ms
88,660 KB |
testcase_11 | AC | 155 ms
89,964 KB |
testcase_12 | AC | 142 ms
89,160 KB |
testcase_13 | AC | 170 ms
89,684 KB |
testcase_14 | AC | 110 ms
86,500 KB |
testcase_15 | AC | 137 ms
88,896 KB |
testcase_16 | AC | 163 ms
89,632 KB |
testcase_17 | AC | 156 ms
90,288 KB |
testcase_18 | AC | 128 ms
88,948 KB |
testcase_19 | AC | 149 ms
89,588 KB |
testcase_20 | AC | 162 ms
89,804 KB |
testcase_21 | AC | 109 ms
86,560 KB |
testcase_22 | AC | 137 ms
89,164 KB |
testcase_23 | AC | 155 ms
89,604 KB |
testcase_24 | AC | 138 ms
88,788 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
ソースコード
#!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools import bisect import heapq def input(): return sys.stdin.readline()[:-1] # sys.setrecursionlimit(1000000) # _INPUT = """# paste here... # """ # sys.stdin = io.StringIO(_INPUT) INF = 10**10 class UnionFind(): parents = [] sizes = [] count = 0 def __init__(self, n): self.count = n self.parents = [i for i in range(n)] self.sizes = [1 for i in range(n)] def find(self, i): if self.parents[i] == i: return i else: self.parents[i] = self.find(self.parents[i]) return self.parents[i] def unite(self, i, j): root_i = self.find(i) root_j = self.find(j) if root_i == root_j: return elif root_i < root_j: self.parents[root_j] = root_i self.sizes[root_i] += self.sizes[root_j] else: self.parents[root_i] = root_j self.sizes[root_j] += self.sizes[root_i] def same(self, i, j): return self.find(i) == self.find(j) def size(self, i): return self.sizes[self.find(i)] def group_count(self): return len(set(self.find(i) for i in range(self.count))) def check(r): uf = UnionFind(N) for a, b, c in L: if c <= r: uf.unite(a, b) for i in range(N): if not uf.same(i, 0): return False return True N = int(input()) L = [] for _ in range(N*(N-1)//2): a, b, c = map(int, input().split()) L.append((a-1, b-1, c)) ok = INF ng = 0 while abs(ok-ng) > 1: mid = (ok+ng) // 2 if check(mid): ok = mid else: ng = mid print(ok)