結果
| 問題 |
No.92 逃走経路
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-06-16 20:50:11 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 139 ms / 5,000 ms |
| コード長 | 433 bytes |
| コンパイル時間 | 378 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 7,040 KB |
| 最終ジャッジ日時 | 2024-07-07 03:20:02 |
| 合計ジャッジ時間 | 2,171 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#!/usr/bin/python
from collections import defaultdict
n, m, k = map(int, raw_input().split())
G = defaultdict(list)
for _ in xrange(m):
a, b, c = map(int, raw_input().split())
G[c].append((a-1, b-1))
G[c].append((b-1, a-1))
d = map(int, raw_input().split())
arr = set(xrange(n))
for x in d:
arr = {to for fra, to in G[x] if fra in arr}
res = list(map(lambda e: e+1, arr))
print len(res)
print ' '.join(map(str, res))