結果

問題 No.1812 Uribo Road
ユーザー ytftytft
提出日時 2022-02-13 16:55:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 503 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 10,868 KB
実行使用メモリ 831,120 KB
最終ジャッジ日時 2023-09-11 15:36:04
合計ジャッジ時間 15,193 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 217 ms
43,168 KB
testcase_01 AC 213 ms
43,384 KB
testcase_02 AC 211 ms
43,268 KB
testcase_03 AC 409 ms
64,752 KB
testcase_04 AC 205 ms
42,952 KB
testcase_05 AC 205 ms
43,148 KB
testcase_06 AC 205 ms
43,172 KB
testcase_07 AC 223 ms
43,820 KB
testcase_08 AC 494 ms
74,388 KB
testcase_09 AC 750 ms
102,716 KB
testcase_10 AC 438 ms
69,244 KB
testcase_11 AC 315 ms
54,444 KB
testcase_12 MLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path
N,M,K=map(int,input().split())
R=list(map(int,input().split()))
mask=[0 for i in range(M)]
for i in range(K):
	mask[R[i]-1]=pow(2,i)
weight=[]
begin=[]
end=[]
for i in range(M):
	A,B,C=map(int,input().split())
	for j in range(pow(2,K)):
		begin+=[A-1+j*N,B-1+j*N]
		end+=[B-1+(j|mask[i])*N,A-1+(j|mask[i])*N]
		weight+=[C,C]
graph=csr_matrix((weight,(begin,end)))
print(int(shortest_path(graph,indices=0)[N*pow(2,K)-1]))
0