結果

問題 No.807 umg tours
ユーザー yuruhiyayuruhiya
提出日時 2020-09-06 10:42:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,561 ms / 4,000 ms
コード長 425 bytes
コンパイル時間 823 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 303,556 KB
最終ジャッジ日時 2023-08-19 13:35:57
合計ジャッジ時間 34,594 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 181 ms
43,524 KB
testcase_01 AC 183 ms
43,596 KB
testcase_02 AC 188 ms
44,044 KB
testcase_03 AC 184 ms
44,036 KB
testcase_04 AC 179 ms
43,672 KB
testcase_05 AC 177 ms
43,944 KB
testcase_06 AC 185 ms
44,204 KB
testcase_07 AC 194 ms
43,900 KB
testcase_08 AC 181 ms
43,540 KB
testcase_09 AC 184 ms
43,368 KB
testcase_10 AC 181 ms
43,672 KB
testcase_11 AC 1,998 ms
266,404 KB
testcase_12 AC 1,429 ms
186,748 KB
testcase_13 AC 2,059 ms
261,168 KB
testcase_14 AC 972 ms
134,100 KB
testcase_15 AC 812 ms
117,012 KB
testcase_16 AC 2,301 ms
280,284 KB
testcase_17 AC 2,495 ms
303,496 KB
testcase_18 AC 2,547 ms
303,272 KB
testcase_19 AC 2,561 ms
303,244 KB
testcase_20 AC 1,414 ms
164,296 KB
testcase_21 AC 1,485 ms
170,308 KB
testcase_22 AC 685 ms
98,280 KB
testcase_23 AC 561 ms
87,280 KB
testcase_24 AC 1,917 ms
234,988 KB
testcase_25 AC 2,471 ms
303,556 KB
権限があれば一括ダウンロードができます

ソースコード

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