結果

問題 No.92 逃走経路
ユーザー yuppe19 😺yuppe19 😺
提出日時 2015-06-16 20:50:11
言語 Python2
(2.7.18)
結果
AC  
実行時間 161 ms / 5,000 ms
コード長 433 bytes
コンパイル時間 1,082 ms
コンパイル使用メモリ 6,584 KB
実行使用メモリ 6,812 KB
最終ジャッジ日時 2023-09-21 09:04:11
合計ジャッジ時間 2,656 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
6,676 KB
testcase_01 AC 12 ms
6,444 KB
testcase_02 AC 12 ms
6,220 KB
testcase_03 AC 12 ms
6,220 KB
testcase_04 AC 12 ms
6,196 KB
testcase_05 AC 156 ms
6,524 KB
testcase_06 AC 18 ms
6,744 KB
testcase_07 AC 17 ms
6,812 KB
testcase_08 AC 13 ms
6,444 KB
testcase_09 AC 21 ms
6,320 KB
testcase_10 AC 156 ms
6,436 KB
testcase_11 AC 145 ms
6,468 KB
testcase_12 AC 161 ms
6,452 KB
testcase_13 AC 20 ms
6,452 KB
testcase_14 AC 25 ms
6,276 KB
testcase_15 AC 27 ms
6,432 KB
testcase_16 AC 27 ms
6,444 KB
testcase_17 AC 28 ms
6,572 KB
testcase_18 AC 23 ms
6,596 KB
testcase_19 AC 20 ms
6,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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))
0