結果

問題 No.1639 最小通信路
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-28 12:39:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 252 ms / 2,000 ms
コード長 700 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 79,716 KB
最終ジャッジ日時 2023-08-28 09:04:29
合計ジャッジ時間 9,140 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,388 KB
testcase_01 AC 108 ms
76,908 KB
testcase_02 AC 252 ms
79,716 KB
testcase_03 AC 245 ms
78,960 KB
testcase_04 AC 201 ms
79,136 KB
testcase_05 AC 160 ms
77,992 KB
testcase_06 AC 179 ms
78,212 KB
testcase_07 AC 109 ms
76,808 KB
testcase_08 AC 217 ms
78,664 KB
testcase_09 AC 122 ms
77,060 KB
testcase_10 AC 138 ms
76,968 KB
testcase_11 AC 200 ms
78,236 KB
testcase_12 AC 144 ms
77,272 KB
testcase_13 AC 247 ms
79,204 KB
testcase_14 AC 111 ms
76,796 KB
testcase_15 AC 144 ms
76,756 KB
testcase_16 AC 202 ms
78,256 KB
testcase_17 AC 220 ms
78,516 KB
testcase_18 AC 125 ms
77,152 KB
testcase_19 AC 178 ms
77,916 KB
testcase_20 AC 222 ms
78,520 KB
testcase_21 AC 106 ms
77,084 KB
testcase_22 AC 148 ms
77,220 KB
testcase_23 AC 184 ms
78,084 KB
testcase_24 AC 145 ms
77,032 KB
testcase_25 AC 122 ms
76,932 KB
testcase_26 AC 113 ms
76,800 KB
testcase_27 AC 116 ms
76,824 KB
testcase_28 AC 109 ms
76,984 KB
testcase_29 AC 148 ms
77,764 KB
testcase_30 AC 186 ms
77,768 KB
testcase_31 AC 117 ms
76,472 KB
testcase_32 AC 156 ms
78,136 KB
testcase_33 AC 119 ms
76,632 KB
testcase_34 AC 159 ms
77,904 KB
testcase_35 AC 216 ms
78,720 KB
testcase_36 AC 159 ms
78,580 KB
testcase_37 AC 164 ms
77,568 KB
testcase_38 AC 110 ms
76,904 KB
testcase_39 AC 120 ms
76,880 KB
testcase_40 AC 112 ms
77,048 KB
testcase_41 AC 115 ms
76,848 KB
testcase_42 AC 163 ms
77,924 KB
testcase_43 AC 122 ms
76,668 KB
testcase_44 AC 109 ms
77,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n=int(input())
g=[[] for _ in range(n)]
for _ in range(n*(n-1)//2):
    a,b,c=map(int,input().split())
    a-=1;b-=1
    g[a].append((b,c))
    g[b].append((a,c))
def f(d):
    visit=[False]*n
    q=deque()
    q.append(0)
    while q:
        now=q.popleft()
        if visit[now]:
            continue
        visit[now]=True
        for to,cost in g[now]:
            if cost>d:
                continue
            if visit[to]:
                continue
            q.append(to)
    for i in visit:
        if i==False:
            return False
    return True
r=10**100
l=0
while r-l>1:
    mid=(l+r)//2
    if f(mid):
        r=mid
    else:
        l=mid
print(r)
0