結果

問題 No.92 逃走経路
ユーザー hiyokko2hiyokko2
提出日時 2016-07-29 22:26:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 399 ms / 5,000 ms
コード長 416 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-24 12:22:04
合計ジャッジ時間 4,232 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 173 ms
11,008 KB
testcase_01 AC 26 ms
10,496 KB
testcase_02 AC 27 ms
10,624 KB
testcase_03 AC 26 ms
10,624 KB
testcase_04 AC 25 ms
10,496 KB
testcase_05 AC 388 ms
10,624 KB
testcase_06 AC 286 ms
11,008 KB
testcase_07 AC 276 ms
10,880 KB
testcase_08 AC 28 ms
10,496 KB
testcase_09 AC 58 ms
10,624 KB
testcase_10 AC 399 ms
10,624 KB
testcase_11 AC 357 ms
10,752 KB
testcase_12 AC 391 ms
10,880 KB
testcase_13 AC 48 ms
10,624 KB
testcase_14 AC 63 ms
10,880 KB
testcase_15 AC 108 ms
10,880 KB
testcase_16 AC 105 ms
10,624 KB
testcase_17 AC 162 ms
10,880 KB
testcase_18 AC 185 ms
10,880 KB
testcase_19 AC 179 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()))

kouho = set(range(1, N + 1))
for i in range(K):
	new_kouho = set()
	for j in kouho:
		for (v, c) in G[j]:
			if c == d[i]:
				new_kouho.add(v)
	kouho = new_kouho

print(len(kouho))
print(' '.join(map(str, kouho)))
0