結果

問題 No.92 逃走経路
ユーザー ytftytft
提出日時 2022-11-10 09:15:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 411 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 10,796 KB
実行使用メモリ 90,184 KB
最終ジャッジ日時 2023-09-30 18:39:12
合計ジャッジ時間 6,488 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 188 ms
90,184 KB
testcase_01 AC 133 ms
29,544 KB
testcase_02 AC 135 ms
29,648 KB
testcase_03 AC 135 ms
29,596 KB
testcase_04 AC 137 ms
29,548 KB
testcase_05 AC 139 ms
29,632 KB
testcase_06 AC 139 ms
30,012 KB
testcase_07 AC 140 ms
29,756 KB
testcase_08 AC 135 ms
29,648 KB
testcase_09 AC 136 ms
29,772 KB
testcase_10 AC 139 ms
29,720 KB
testcase_11 AC 141 ms
29,568 KB
testcase_12 AC 143 ms
29,624 KB
testcase_13 WA -
testcase_14 AC 140 ms
29,808 KB
testcase_15 AC 140 ms
29,948 KB
testcase_16 AC 142 ms
29,952 KB
testcase_17 AC 144 ms
30,528 KB
testcase_18 AC 140 ms
30,040 KB
testcase_19 AC 142 ms
29,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import numpy as np
input=lambda:sys.stdin.readline().rstrip()
N,M,K=map(int,input().split())
mat={}
for i in range(M):
	a,b,c=map(int,input().split())
	if not c in mat:
		mat[c]=np.zeros((N,N))
	mat[c][a-1][b-1]=1
	mat[c][b-1][a-1]=1
D=list(map(int,input().split()))
pot=np.ones((N,1))
for i in D:
	pot=mat[i]@pot
ans=[]
for i in range(N):
	if pot[i][0]:
		ans.append(i+1)
print(len(ans))
print(*ans)
0