結果
問題 |
No.92 逃走経路
|
ユーザー |
![]() |
提出日時 | 2020-05-03 20:11:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 538 bytes |
コンパイル時間 | 286 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 17,824 KB |
最終ジャッジ日時 | 2024-06-22 16:28:24 |
合計ジャッジ時間 | 13,448 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | TLE * 1 -- * 17 |
ソースコード
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)