結果

問題 No.1473 おでぶなおばけさん
ユーザー titiatitia
提出日時 2021-04-10 00:45:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 728 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 44,916 KB
最終ジャッジ日時 2023-09-07 19:41:32
合計ジャッジ時間 14,577 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,452 KB
testcase_01 AC 19 ms
8,616 KB
testcase_02 AC 1,810 ms
41,848 KB
testcase_03 AC 849 ms
37,260 KB
testcase_04 AC 1,453 ms
26,896 KB
testcase_05 AC 522 ms
14,948 KB
testcase_06 AC 1,937 ms
38,932 KB
testcase_07 AC 1,525 ms
44,236 KB
testcase_08 TLE -
testcase_09 AC 1,443 ms
43,552 KB
testcase_10 AC 1,336 ms
29,588 KB
testcase_11 AC 1,736 ms
28,228 KB
testcase_12 AC 967 ms
30,220 KB
testcase_13 AC 491 ms
20,756 KB
testcase_14 AC 470 ms
17,184 KB
testcase_15 AC 1,080 ms
25,312 KB
testcase_16 AC 775 ms
28,604 KB
testcase_17 AC 46 ms
9,896 KB
testcase_18 AC 99 ms
10,652 KB
testcase_19 AC 658 ms
27,560 KB
testcase_20 AC 680 ms
33,728 KB
testcase_21 AC 1,243 ms
34,440 KB
testcase_22 AC 419 ms
34,196 KB
testcase_23 AC 356 ms
31,300 KB
testcase_24 AC 353 ms
30,356 KB
testcase_25 AC 1,864 ms
36,972 KB
testcase_26 AC 1,898 ms
37,820 KB
testcase_27 AC 667 ms
20,032 KB
testcase_28 TLE -
testcase_29 AC 1,245 ms
32,996 KB
testcase_30 TLE -
testcase_31 AC 978 ms
42,092 KB
testcase_32 AC 1,250 ms
39,976 KB
testcase_33 AC 885 ms
33,516 KB
testcase_34 AC 575 ms
21,516 KB
testcase_35 AC 463 ms
23,324 KB
testcase_36 AC 1,330 ms
29,760 KB
testcase_37 AC 1,274 ms
32,424 KB
testcase_38 AC 312 ms
13,164 KB
testcase_39 AC 870 ms
28,940 KB
testcase_40 AC 786 ms
28,760 KB
testcase_41 AC 1,084 ms
26,012 KB
testcase_42 AC 1,075 ms
25,804 KB
testcase_43 AC 1,027 ms
35,824 KB
testcase_44 AC 1,014 ms
35,928 KB
testcase_45 AC 1,029 ms
35,788 KB
testcase_46 AC 731 ms
33,844 KB
testcase_47 AC 1,365 ms
39,216 KB
testcase_48 AC 1,364 ms
36,640 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