結果
問題 | No.92 逃走経路 |
ユーザー |
![]() |
提出日時 | 2021-08-03 13:10:39 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,507 ms / 5,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 153 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 75,904 KB |
最終ジャッジ日時 | 2024-09-16 14:56:10 |
合計ジャッジ時間 | 10,263 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
N,M,K = map(int,input().split())L = [[] for _ in range(N+1)]for i in range(M):a,b,c = map(int,input().split())L[a].append((b,c))L[b].append((a,c))D = list(map(int,input().split()))[::-1]ANS = []for i in range(1,N+1):S = set()S.add(i)for d in D:NEXT = set()for s in S:for l in L[s]:n,c = lif d==c:NEXT.add(n)S = NEXTif len(S):ANS.append(i)print(len(ANS))print(*ANS)