結果

問題 No.92 逃走経路
ユーザー tnoda_tnoda_
提出日時 2015-08-09 19:43:43
言語 Python2
(2.7.18)
結果
AC  
実行時間 197 ms / 5,000 ms
コード長 438 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 6,696 KB
実行使用メモリ 6,264 KB
最終ジャッジ日時 2023-09-25 07:32:55
合計ジャッジ時間 2,577 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
6,264 KB
testcase_01 AC 11 ms
5,940 KB
testcase_02 AC 11 ms
5,920 KB
testcase_03 AC 11 ms
5,848 KB
testcase_04 AC 11 ms
5,940 KB
testcase_05 AC 192 ms
6,228 KB
testcase_06 AC 115 ms
6,100 KB
testcase_07 AC 116 ms
6,196 KB
testcase_08 AC 14 ms
5,864 KB
testcase_09 AC 32 ms
5,908 KB
testcase_10 AC 193 ms
6,236 KB
testcase_11 AC 178 ms
6,008 KB
testcase_12 AC 197 ms
6,016 KB
testcase_13 AC 24 ms
6,028 KB
testcase_14 AC 32 ms
6,020 KB
testcase_15 AC 51 ms
6,104 KB
testcase_16 AC 51 ms
6,116 KB
testcase_17 AC 75 ms
6,128 KB
testcase_18 AC 83 ms
6,220 KB
testcase_19 AC 83 ms
6,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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