結果

問題 No.1639 最小通信路
ユーザー だれだれ
提出日時 2021-08-06 21:52:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 723 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 77,176 KB
最終ジャッジ日時 2023-10-17 03:12:29
合計ジャッジ時間 5,539 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,544 KB
testcase_01 AC 52 ms
64,448 KB
testcase_02 AC 126 ms
77,100 KB
testcase_03 AC 158 ms
77,164 KB
testcase_04 AC 135 ms
77,148 KB
testcase_05 AC 102 ms
76,760 KB
testcase_06 AC 108 ms
76,820 KB
testcase_07 AC 53 ms
64,472 KB
testcase_08 AC 118 ms
77,012 KB
testcase_09 AC 65 ms
68,696 KB
testcase_10 AC 79 ms
72,828 KB
testcase_11 AC 112 ms
76,856 KB
testcase_12 AC 90 ms
76,320 KB
testcase_13 AC 125 ms
77,068 KB
testcase_14 AC 54 ms
64,468 KB
testcase_15 AC 83 ms
73,924 KB
testcase_16 AC 113 ms
76,872 KB
testcase_17 AC 118 ms
77,016 KB
testcase_18 AC 65 ms
68,632 KB
testcase_19 AC 108 ms
76,808 KB
testcase_20 AC 119 ms
76,928 KB
testcase_21 AC 47 ms
61,844 KB
testcase_22 AC 91 ms
76,312 KB
testcase_23 AC 107 ms
76,812 KB
testcase_24 AC 85 ms
74,408 KB
testcase_25 AC 69 ms
68,604 KB
testcase_26 AC 59 ms
66,536 KB
testcase_27 AC 58 ms
66,560 KB
testcase_28 AC 55 ms
66,540 KB
testcase_29 AC 109 ms
76,980 KB
testcase_30 AC 118 ms
77,052 KB
testcase_31 AC 64 ms
68,600 KB
testcase_32 AC 110 ms
76,932 KB
testcase_33 AC 61 ms
66,552 KB
testcase_34 AC 110 ms
76,980 KB
testcase_35 AC 137 ms
77,176 KB
testcase_36 AC 110 ms
76,988 KB
testcase_37 AC 111 ms
76,956 KB
testcase_38 AC 55 ms
66,536 KB
testcase_39 AC 68 ms
68,604 KB
testcase_40 AC 57 ms
66,536 KB
testcase_41 AC 62 ms
66,552 KB
testcase_42 AC 116 ms
77,120 KB
testcase_43 AC 64 ms
68,600 KB
testcase_44 AC 57 ms
66,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n = int(input())
edge = [[] for _ in range(n)]

for _ in range(n * (n - 1) // 2):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append((b, c))
    edge[b].append((a, c))

ok = 10 ** 100
ng = 0

while ok - ng > 1:
    mid = (ok + ng) // 2
    que = deque()
    que.append(0)
    visited = [0] * n
    visited[0] = 1
    while que:
        now = que.popleft()
        for i, j in edge[now]:
            if j > mid:
                continue
            if visited[i]:
                continue
            visited[i] = 1
            que.append(i)
    f = 1
    for i in range(n):
        f &= visited[i]
    if f:
        ok = mid
    else:
        ng = mid

print(ok)
0