#include<bits/stdc++.h> using namespace std; const int Max=1e5+10; bool visit[Max]; struct status{ int p; int t; status(int a,int b):p(a),t(b){ } }; void BFS(int n,int k){ queue<status> q; q.push(status(n,0)); visit[n]=1; while(!q.empty()){ status current=q.front(); q.pop();...