結果

問題 No.1473 おでぶなおばけさん
ユーザー titiatitia
提出日時 2021-04-10 00:40:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 744 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 45,160 KB
最終ジャッジ日時 2023-09-07 19:37:06
合計ジャッジ時間 23,923 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,468 KB
testcase_01 AC 20 ms
8,468 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 430 ms
34,244 KB
testcase_23 AC 361 ms
31,196 KB
testcase_24 AC 360 ms
30,276 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 1,068 ms
25,796 KB
testcase_42 AC 1,082 ms
25,900 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import deque

n,m=map(int,input().split())
E=[[] for i in range(n+1)]

for i in range(m):
    s,t,d=map(int,input().split())
    E[s].append((t,d))
    E[t].append((s,d))


OK=1
NG=1<<60

while NG-OK>1:
    mid=(OK+NG)//2

    GO=[0]*(n+1)
    GO[1]=1
    Q=[1]

    while Q:
        x=Q.pop()
        for to,d in E[x]:
            if d>=mid and GO[to]==0:
                GO[to]=1
                Q.append(to)

        if GO[n]==1:
            OK=mid
        else:
            NG=mid

X=[-1]*(n+1)
X[1]=0
Q=deque([1])

while Q:
    x=Q.popleft()
    
    for to,d in E[x]:
        if d>=OK and X[to]==-1:
            X[to]=X[x]+1
            Q.append(to)

print(OK,X[n])
                
0