結果

問題 No.92 逃走経路
コンテスト
ユーザー tnoda_
提出日時 2015-08-09 19:43:43
言語 Python2
(2.7.18)
コンパイル:
python2x -m py_compile _filename_
実行:
/usr/bin/python2x Main.pyc
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 438 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 15 ms
コンパイル使用メモリ 9,684 KB
実行使用メモリ 9,924 KB
最終ジャッジ日時 2026-11-06 13:11:38
合計ジャッジ時間 2,813 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, M, K = map(int, raw_input().strip().split())
E = [[] for i in range(N+1)]
for i in range(M):
    a, b, c = map(int, raw_input().strip().split())
    E[a].append((b, c))
    E[b].append((a, c))
ds = map(int, raw_input().strip().split())
ans = range(N+1)
while ds:
    ans = set(t for s in ans for (t, c) in E[s] if c == ds[0])
    ds = ds[1:]

L = len(ans)
print(L)
if L == 0:
    print(ans[0])
else:
    print(' '.join(map(str, ans)))
0