結果

問題 No.1639 最小通信路
ユーザー DrDrpilotDrDrpilot
提出日時 2022-04-12 19:47:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 246 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 79,572 KB
最終ジャッジ日時 2023-08-23 05:13:46
合計ジャッジ時間 9,554 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
71,680 KB
testcase_01 AC 103 ms
77,224 KB
testcase_02 AC 246 ms
79,572 KB
testcase_03 AC 243 ms
79,368 KB
testcase_04 AC 241 ms
79,048 KB
testcase_05 AC 157 ms
78,208 KB
testcase_06 AC 178 ms
78,476 KB
testcase_07 AC 103 ms
77,324 KB
testcase_08 AC 213 ms
78,960 KB
testcase_09 AC 113 ms
76,676 KB
testcase_10 AC 127 ms
77,104 KB
testcase_11 AC 187 ms
78,580 KB
testcase_12 AC 138 ms
77,516 KB
testcase_13 AC 235 ms
79,328 KB
testcase_14 AC 103 ms
77,200 KB
testcase_15 AC 130 ms
77,288 KB
testcase_16 AC 192 ms
78,556 KB
testcase_17 AC 215 ms
79,044 KB
testcase_18 AC 122 ms
76,996 KB
testcase_19 AC 170 ms
78,396 KB
testcase_20 AC 215 ms
79,096 KB
testcase_21 AC 99 ms
77,188 KB
testcase_22 AC 143 ms
77,412 KB
testcase_23 AC 177 ms
78,412 KB
testcase_24 AC 141 ms
77,616 KB
testcase_25 AC 116 ms
76,748 KB
testcase_26 AC 108 ms
77,096 KB
testcase_27 AC 106 ms
77,280 KB
testcase_28 AC 109 ms
76,988 KB
testcase_29 AC 140 ms
78,088 KB
testcase_30 AC 174 ms
78,068 KB
testcase_31 AC 116 ms
77,052 KB
testcase_32 AC 145 ms
78,060 KB
testcase_33 AC 110 ms
77,064 KB
testcase_34 AC 158 ms
77,992 KB
testcase_35 AC 206 ms
78,872 KB
testcase_36 AC 155 ms
78,880 KB
testcase_37 AC 154 ms
77,784 KB
testcase_38 AC 102 ms
77,300 KB
testcase_39 AC 114 ms
76,752 KB
testcase_40 AC 105 ms
77,124 KB
testcase_41 AC 111 ms
77,112 KB
testcase_42 AC 148 ms
78,016 KB
testcase_43 AC 111 ms
77,072 KB
testcase_44 AC 103 ms
77,204 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**100
ng=0
while ok-ng>1:
    mid=(ok+ng)//2
    if f(mid):
        ok=mid
    else:
        ng=mid
print(ok)
0