結果

問題 No.1473 おでぶなおばけさん
ユーザー NoaSaberNoaSaber
提出日時 2021-04-09 22:52:56
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 703 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 102,880 KB
最終ジャッジ日時 2023-09-07 12:32:11
合計ジャッジ時間 21,829 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,264 KB
testcase_01 AC 73 ms
71,040 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 549 ms
96,184 KB
testcase_08 WA -
testcase_09 AC 544 ms
96,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 218 ms
88,424 KB
testcase_13 AC 148 ms
81,632 KB
testcase_14 AC 130 ms
79,356 KB
testcase_15 AC 170 ms
84,512 KB
testcase_16 AC 216 ms
85,648 KB
testcase_17 AC 123 ms
77,852 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
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 AC 208 ms
85,784 KB
testcase_41 AC 167 ms
88,128 KB
testcase_42 AC 169 ms
88,240 KB
testcase_43 AC 521 ms
102,880 KB
testcase_44 AC 541 ms
102,772 KB
testcase_45 AC 528 ms
102,780 KB
testcase_46 AC 226 ms
88,832 KB
testcase_47 AC 249 ms
91,404 KB
testcase_48 AC 263 ms
90,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
edge=[[] for i in range(n)]
for i in range(m):
    s,t,d=map(int,input().split())
    s-=1;t-=1
    edge[s].append((t,d*-1))
    edge[t].append((s,d*-1))
from heapq import heappop,heappush
def dijkstra(s,n,edge):
    inf=float("inf")
    ans=[inf]*n
    ans[s]=-inf
    root=[0]*n
    open=[[-inf,s]]
    while open:
        cost,node=heappop(open)
        if ans[node]<cost:
            continue
        for next,e_cost in edge[node]:
            if max(cost,e_cost)<ans[next]:
                ans[next]=max(cost,e_cost)
                root[next]=root[node]+1
                heappush(open,[max(cost,e_cost),next])
    return ans[-1]*-1,root[-1]
print(*dijkstra(0,n,edge))
0