結果

問題 No.1639 最小通信路
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-28 12:36:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 298 ms / 2,000 ms
コード長 700 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,936 KB
実行使用メモリ 9,824 KB
最終ジャッジ日時 2023-08-28 09:01:18
合計ジャッジ時間 5,391 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,648 KB
testcase_01 AC 19 ms
8,660 KB
testcase_02 AC 298 ms
9,520 KB
testcase_03 AC 187 ms
9,704 KB
testcase_04 AC 184 ms
9,824 KB
testcase_05 AC 77 ms
8,732 KB
testcase_06 AC 122 ms
8,904 KB
testcase_07 AC 20 ms
8,452 KB
testcase_08 AC 208 ms
9,276 KB
testcase_09 AC 32 ms
8,572 KB
testcase_10 AC 53 ms
8,720 KB
testcase_11 AC 150 ms
8,960 KB
testcase_12 AC 67 ms
8,804 KB
testcase_13 AC 281 ms
9,480 KB
testcase_14 AC 19 ms
8,536 KB
testcase_15 AC 57 ms
8,792 KB
testcase_16 AC 162 ms
9,036 KB
testcase_17 AC 208 ms
9,348 KB
testcase_18 AC 30 ms
8,604 KB
testcase_19 AC 91 ms
8,976 KB
testcase_20 AC 213 ms
9,336 KB
testcase_21 AC 19 ms
8,600 KB
testcase_22 AC 71 ms
8,816 KB
testcase_23 AC 121 ms
8,900 KB
testcase_24 AC 64 ms
8,744 KB
testcase_25 AC 33 ms
8,620 KB
testcase_26 AC 24 ms
8,524 KB
testcase_27 AC 21 ms
8,508 KB
testcase_28 AC 20 ms
8,488 KB
testcase_29 AC 59 ms
8,864 KB
testcase_30 AC 87 ms
9,164 KB
testcase_31 AC 26 ms
8,648 KB
testcase_32 AC 68 ms
8,984 KB
testcase_33 AC 27 ms
8,616 KB
testcase_34 AC 63 ms
8,904 KB
testcase_35 AC 139 ms
9,316 KB
testcase_36 AC 63 ms
8,772 KB
testcase_37 AC 71 ms
8,976 KB
testcase_38 AC 20 ms
8,544 KB
testcase_39 AC 34 ms
8,628 KB
testcase_40 AC 22 ms
8,652 KB
testcase_41 AC 27 ms
8,616 KB
testcase_42 AC 85 ms
9,220 KB
testcase_43 AC 27 ms
8,684 KB
testcase_44 AC 20 ms
8,644 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