結果

問題 No.92 逃走経路
ユーザー pluto77pluto77
提出日時 2016-07-18 11:27:16
言語 Python2
(2.7.18)
結果
AC  
実行時間 381 ms / 5,000 ms
コード長 481 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 7,196 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-23 15:13:32
合計ジャッジ時間 4,010 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
6,812 KB
testcase_01 AC 11 ms
6,944 KB
testcase_02 AC 10 ms
6,944 KB
testcase_03 AC 10 ms
6,940 KB
testcase_04 AC 9 ms
6,944 KB
testcase_05 AC 366 ms
6,940 KB
testcase_06 AC 207 ms
6,944 KB
testcase_07 AC 207 ms
6,940 KB
testcase_08 AC 11 ms
6,944 KB
testcase_09 AC 40 ms
6,940 KB
testcase_10 AC 381 ms
6,940 KB
testcase_11 AC 339 ms
6,940 KB
testcase_12 AC 375 ms
6,944 KB
testcase_13 AC 30 ms
6,940 KB
testcase_14 AC 39 ms
6,940 KB
testcase_15 AC 73 ms
6,940 KB
testcase_16 AC 73 ms
6,940 KB
testcase_17 AC 119 ms
6,944 KB
testcase_18 AC 138 ms
6,944 KB
testcase_19 AC 137 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding: utf-8
#yuki_92

n,m,k=map(int,raw_input().split())
edge=[[] for i in xrange(n)]
s=set([])
for i in xrange(m):
 a,b,c=map(int,raw_input().split())
 edge[a-1].append((b-1,c))
 edge[b-1].append((a-1,c))
d=map(int,raw_input().split())

for i in xrange(n):
 for j,c in edge[i]:
  if c==d[0]:
   s.add(i)
   
for i in xrange(1,k):
 t=set([])
 for k in s:
  for j,c in edge[k]:
    if c==d[i]:
     t.add(j)
 s=t
 
res=list(s)
print len(res)
res.sort()
for i in res:
 print i+1,
0