結果

問題 No.807 umg tours
ユーザー yuruhiyayuruhiya
提出日時 2020-09-06 10:45:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 465 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 315,088 KB
最終ジャッジ日時 2024-11-29 06:48:38
合計ジャッジ時間 64,016 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 TLE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

from numpy import*
from scipy.sparse import*
from sys import stdin
n,m=map(int,stdin.readline().split())
e=[]
for i in range(m):
    a,b,c=map(int,stdin.readline().split())
    for _ in [0,0]:
        e.append([a,b,c])
        e.append([a,b+n,0])
        e.append([a+n,b+n,c])
        a,b=b,a
edge=array(e,int64).T
graph=csr_matrix((edge[2],edge[:2]-1),(n+n,n+n))
dist=csgraph.dijkstra(graph,True,0)
for i in range(n):
    print(int(dist[i]+min(dist[i],dist[i+n])))
0