結果
問題 | No.807 umg tours |
ユーザー | yuruhiya |
提出日時 | 2020-09-06 10:58:18 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 2,302 ms / 4,000 ms |
コード長 | 595 bytes |
コンパイル時間 | 461 ms |
コンパイル使用メモリ | 10,776 KB |
実行使用メモリ | 287,936 KB |
最終ジャッジ日時 | 2023-08-19 13:40:11 |
合計ジャッジ時間 | 28,264 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge10 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 208 ms
43,696 KB |
testcase_01 | AC | 208 ms
43,520 KB |
testcase_02 | AC | 208 ms
44,192 KB |
testcase_03 | AC | 211 ms
43,804 KB |
testcase_04 | AC | 207 ms
43,408 KB |
testcase_05 | AC | 210 ms
43,824 KB |
testcase_06 | AC | 214 ms
44,368 KB |
testcase_07 | AC | 215 ms
43,708 KB |
testcase_08 | AC | 208 ms
43,180 KB |
testcase_09 | AC | 218 ms
43,200 KB |
testcase_10 | AC | 217 ms
43,448 KB |
testcase_11 | AC | 1,707 ms
249,164 KB |
testcase_12 | AC | 1,314 ms
180,548 KB |
testcase_13 | AC | 1,869 ms
247,220 KB |
testcase_14 | AC | 886 ms
129,048 KB |
testcase_15 | AC | 738 ms
113,768 KB |
testcase_16 | AC | 2,083 ms
263,832 KB |
testcase_17 | AC | 2,273 ms
287,616 KB |
testcase_18 | AC | 2,302 ms
287,832 KB |
testcase_19 | AC | 2,287 ms
287,936 KB |
testcase_20 | AC | 1,301 ms
163,688 KB |
testcase_21 | AC | 1,335 ms
168,408 KB |
testcase_22 | AC | 646 ms
98,436 KB |
testcase_23 | AC | 524 ms
86,836 KB |
testcase_24 | AC | 1,621 ms
227,180 KB |
testcase_25 | AC | 2,235 ms
287,852 KB |
ソースコード
from numpy import* from scipy.sparse import* from sys import stdin def solve(): n,m=map(int,stdin.readline().split()) e=[[]]*(m*6) p=0 for i in range(m): a,b,c=map(int,stdin.readline().split()) a-=1;b-=1 e[p]=[a,b,c] e[p+1]=[a,b+n,0] e[p+2]=[a+n,b+n,c] e[p+3]=[b,a,c] e[p+4]=[b,a+n,0] e[p+5]=[b+n,a+n,c] p+=6 edge=array(e,int64).T graph=csr_matrix((edge[2],edge[:2]),(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]))) solve()