結果

問題 No.1473 おでぶなおばけさん
ユーザー titiatitia
提出日時 2021-04-10 00:45:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,283 ms / 2,000 ms
コード長 728 bytes
コンパイル時間 873 ms
コンパイル使用メモリ 86,472 KB
実行使用メモリ 139,004 KB
最終ジャッジ日時 2023-09-07 19:42:18
合計ジャッジ時間 24,002 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,412 KB
testcase_01 AC 98 ms
71,204 KB
testcase_02 AC 931 ms
126,204 KB
testcase_03 AC 512 ms
109,560 KB
testcase_04 AC 692 ms
100,932 KB
testcase_05 AC 272 ms
81,380 KB
testcase_06 AC 869 ms
117,120 KB
testcase_07 AC 752 ms
132,060 KB
testcase_08 AC 1,283 ms
127,844 KB
testcase_09 AC 728 ms
133,232 KB
testcase_10 AC 215 ms
85,904 KB
testcase_11 AC 221 ms
85,728 KB
testcase_12 AC 225 ms
85,740 KB
testcase_13 AC 183 ms
81,952 KB
testcase_14 AC 159 ms
79,500 KB
testcase_15 AC 201 ms
85,112 KB
testcase_16 AC 184 ms
84,728 KB
testcase_17 AC 123 ms
77,460 KB
testcase_18 AC 129 ms
77,480 KB
testcase_19 AC 274 ms
85,248 KB
testcase_20 AC 438 ms
119,232 KB
testcase_21 AC 472 ms
99,140 KB
testcase_22 AC 309 ms
124,544 KB
testcase_23 AC 268 ms
123,048 KB
testcase_24 AC 275 ms
116,012 KB
testcase_25 AC 810 ms
105,728 KB
testcase_26 AC 816 ms
111,060 KB
testcase_27 AC 259 ms
82,176 KB
testcase_28 AC 957 ms
130,232 KB
testcase_29 AC 521 ms
100,456 KB
testcase_30 AC 788 ms
107,040 KB
testcase_31 AC 539 ms
139,004 KB
testcase_32 AC 594 ms
127,392 KB
testcase_33 AC 490 ms
110,960 KB
testcase_34 AC 351 ms
97,376 KB
testcase_35 AC 269 ms
92,932 KB
testcase_36 AC 435 ms
94,424 KB
testcase_37 AC 646 ms
109,872 KB
testcase_38 AC 182 ms
79,972 KB
testcase_39 AC 194 ms
84,812 KB
testcase_40 AC 193 ms
84,796 KB
testcase_41 AC 206 ms
87,772 KB
testcase_42 AC 207 ms
87,780 KB
testcase_43 AC 276 ms
128,108 KB
testcase_44 AC 270 ms
128,020 KB
testcase_45 AC 277 ms
128,076 KB
testcase_46 AC 332 ms
115,500 KB
testcase_47 AC 482 ms
114,844 KB
testcase_48 AC 459 ms
114,908 KB
権限があれば一括ダウンロードができます

ソースコード

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