結果

問題 No.807 umg tours
ユーザー yuruhiya
提出日時 2020-09-06 10:42:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 425 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 367,632 KB
最終ジャッジ日時 2024-11-29 06:45:31
合計ジャッジ時間 68,078 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 TLE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

from numpy import*
from scipy.sparse import*
n,m=map(int,input().split())
e=[]
for i in range(m):
    a,b,c=map(int,input().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