結果

問題 No.92 逃走経路
ユーザー hiyokko2
提出日時 2016-07-29 22:01:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 518 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-11-06 20:13:41
合計ジャッジ時間 3,153 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 2 WA * 8 RE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(i_, v_):
	if i_ == K:
		ans.append(v_)
		return True
	for (v, c) in G[v_]:
		if c == d[i_]:
			if check(i_ + 1, v):
				return True
	return False

N, M, K = map(int, input().split())
G = [[] for _ in range(N + 1)]
for _ in range(M):
	a, b, c = map(int, input().split())
	G[a].append((b, c))
	G[b].append((a, c))

d = list(map(int, input().split()))
"""
print("d=")
print(d)
print("G=")
print(G)
"""

ans = []
for i in range(1, N + 1):
	check(0, i)
		
print(len(ans))
ans.sort()
print(' '.join(map(str, ans)))
0