結果
問題 | No.92 逃走経路 |
ユーザー |
![]() |
提出日時 | 2021-02-09 11:07:28 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,847 ms / 5,000 ms |
コード長 | 556 bytes |
コンパイル時間 | 139 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 76,928 KB |
最終ジャッジ日時 | 2024-07-06 16:10:52 |
合計ジャッジ時間 | 10,925 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
n,m,k=map(int,input().split())l=[list(map(int,input().split())) for i in range(m)]d=list(map(int,input().split()))d.reverse()c=[[] for i in range(n)]for i in range(m):c[l[i][0]-1].append((l[i][1]-1,l[i][2]))c[l[i][1]-1].append((l[i][0]-1,l[i][2]))ans=[]for i in range(n):p=[i]for j1 in range(k):p2=set()for j2 in range(len(p)):for j3 in range(len(c[p[j2]])):if c[p[j2]][j3][1]==d[j1]:p2.add(c[p[j2]][j3][0])p=list(p2)if len(p)>0:ans.append(str(i+1))print(len(ans))print(' '.join(ans))