結果
| 問題 |
No.92 逃走経路
|
| コンテスト | |
| ユーザー |
tnoda_
|
| 提出日時 | 2015-08-09 19:43:43 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 192 ms / 5,000 ms |
| コード長 | 438 bytes |
| コンパイル時間 | 39 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 6,656 KB |
| 最終ジャッジ日時 | 2024-07-18 06:14:55 |
| 合計ジャッジ時間 | 2,257 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
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)))
tnoda_