#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <deque> using namespace std; typedef long long LL; typedef pair<int,int>PII; const int N=2010,M=N*N; int n,m; int g[N][N]; int dist[N][N]; bool st[N][N]; int bfs() { me...