結果

問題 No.92 逃走経路
ユーザー takakintakakin
提出日時 2020-05-03 20:11:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,755 ms / 5,000 ms
コード長 538 bytes
コンパイル時間 1,453 ms
コンパイル使用メモリ 86,684 KB
実行使用メモリ 76,804 KB
最終ジャッジ日時 2023-09-04 20:02:13
合計ジャッジ時間 13,522 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 733 ms
76,584 KB
testcase_01 AC 72 ms
71,428 KB
testcase_02 AC 71 ms
71,308 KB
testcase_03 AC 72 ms
71,360 KB
testcase_04 AC 72 ms
71,180 KB
testcase_05 AC 119 ms
76,100 KB
testcase_06 AC 94 ms
75,844 KB
testcase_07 AC 95 ms
76,160 KB
testcase_08 AC 83 ms
76,332 KB
testcase_09 AC 90 ms
76,664 KB
testcase_10 AC 1,524 ms
76,620 KB
testcase_11 AC 989 ms
76,788 KB
testcase_12 AC 2,755 ms
76,752 KB
testcase_13 AC 95 ms
76,584 KB
testcase_14 AC 440 ms
76,752 KB
testcase_15 AC 684 ms
76,536 KB
testcase_16 AC 517 ms
76,724 KB
testcase_17 AC 972 ms
76,508 KB
testcase_18 AC 573 ms
76,804 KB
testcase_19 AC 172 ms
76,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,m,k=map(int,input().split())
edge = [[] for i in range(n)]
for i in range(m):
  a,b,c=map(int,input().split())
  edge[a-1].append([c,b-1])
  edge[b-1].append([c,a-1])
D=[int(i) for i in input().split()][::-1]
Ans=[]
for i in range(n):
  S=[i]
  for j in range(k):
    SS=set()
    for s in S:
      for c,g in edge[s]:
        if c==D[j]:
          SS.add(g)
    S=list(SS)
    if not S:
      break
    else:
      continue
  else:
    Ans.append(i+1)
print(len(Ans))
print(*Ans)
0