#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <vector> using namespace std; struct node { int f, s; }; vector<node>imap[40005]; int deep[40005]; int dis[40005]; int fa[40005]; int ff…
#include <iostream> #include<cstring> #include<cstdio> #include<cmath> #include<climits> using namespace std; int g[505][505]; int dx[505],dy[505]; bool vx[505], vy[505]; int dis[505]; int n, x, y; int res, minn; bool find(in…