結果

問題 No.1473 おでぶなおばけさん
ユーザー NoaSaberNoaSaber
提出日時 2021-04-09 23:02:02
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 700 bytes
コンパイル時間 1,177 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 103,172 KB
最終ジャッジ日時 2023-09-07 12:43:48
合計ジャッジ時間 24,603 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,188 KB
testcase_01 AC 78 ms
71,272 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 599 ms
96,368 KB
testcase_08 WA -
testcase_09 AC 590 ms
96,656 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 254 ms
87,964 KB
testcase_13 AC 166 ms
81,764 KB
testcase_14 AC 145 ms
79,756 KB
testcase_15 AC 190 ms
84,748 KB
testcase_16 AC 227 ms
85,924 KB
testcase_17 AC 126 ms
78,016 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 228 ms
85,636 KB
testcase_41 AC 184 ms
88,452 KB
testcase_42 AC 185 ms
88,172 KB
testcase_43 AC 575 ms
102,884 KB
testcase_44 AC 567 ms
103,172 KB
testcase_45 AC 566 ms
103,068 KB
testcase_46 AC 243 ms
89,152 KB
testcase_47 AC 280 ms
91,356 KB
testcase_48 AC 283 ms
90,652 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]=0
    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