#include <iostream> #include <queue> #include <vector> #include <cstring> using namespace std; const int N = 1010; char mpt[N][N]; int vis[N][N]; int dir[4][2] = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}}; int h, w; int sx, sy, ex, ey; struct Node { int x, y, dist; }; int bfs(...