結果

問題 No.1639 最小通信路
ユーザー DrDrpilotDrDrpilot
提出日時 2022-04-12 19:50:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,184 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 88,580 KB
最終ジャッジ日時 2023-08-23 05:16:38
合計ジャッジ時間 21,145 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
77,204 KB
testcase_01 AC 115 ms
77,544 KB
testcase_02 AC 1,184 ms
88,580 KB
testcase_03 AC 969 ms
79,076 KB
testcase_04 AC 954 ms
79,156 KB
testcase_05 AC 356 ms
78,484 KB
testcase_06 AC 553 ms
79,844 KB
testcase_07 AC 118 ms
77,260 KB
testcase_08 AC 900 ms
83,860 KB
testcase_09 AC 168 ms
77,648 KB
testcase_10 AC 260 ms
77,744 KB
testcase_11 AC 671 ms
80,432 KB
testcase_12 AC 314 ms
77,812 KB
testcase_13 AC 1,149 ms
87,744 KB
testcase_14 AC 116 ms
77,548 KB
testcase_15 AC 267 ms
77,568 KB
testcase_16 AC 714 ms
81,240 KB
testcase_17 AC 894 ms
83,908 KB
testcase_18 AC 174 ms
77,684 KB
testcase_19 AC 413 ms
78,860 KB
testcase_20 AC 915 ms
83,868 KB
testcase_21 AC 113 ms
77,276 KB
testcase_22 AC 334 ms
77,820 KB
testcase_23 AC 531 ms
79,308 KB
testcase_24 AC 290 ms
77,728 KB
testcase_25 AC 188 ms
77,588 KB
testcase_26 AC 146 ms
77,588 KB
testcase_27 AC 132 ms
77,212 KB
testcase_28 AC 119 ms
77,244 KB
testcase_29 AC 358 ms
78,444 KB
testcase_30 AC 506 ms
78,748 KB
testcase_31 AC 179 ms
77,464 KB
testcase_32 AC 400 ms
78,288 KB
testcase_33 AC 155 ms
77,556 KB
testcase_34 AC 367 ms
78,280 KB
testcase_35 AC 745 ms
78,736 KB
testcase_36 AC 352 ms
78,060 KB
testcase_37 AC 379 ms
78,324 KB
testcase_38 AC 122 ms
77,604 KB
testcase_39 AC 193 ms
77,492 KB
testcase_40 AC 131 ms
77,348 KB
testcase_41 AC 153 ms
77,476 KB
testcase_42 AC 482 ms
78,828 KB
testcase_43 AC 155 ms
77,484 KB
testcase_44 AC 124 ms
77,544 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(n-1)
    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
ok=10**1000
ng=0
while ok-ng>1:
    mid=(ok+ng)//2
    if f(mid):
        ok=mid
    else:
        ng=mid
print(ok)
0