#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; typedef long long ll; typedef pair P; int main() { int h, w; int ra, ca, rb, cb; cin>>h>>w>>ra>>ca>>rb>>cb; ra--;ca--;rb--;cb--; string s[1400]; for(int i=0; i>s[i]; } queue

que; que.push({ra, ca}); int d[1400][1400]; const int INF=1e9; for(int i=0; id[x][y]+1){ que.push({x1, y1}); d[x1][y1]=d[x][y]+1; } } } int dr[1400][1400]; for(int i=0; idr[x][y]+1){ que.push({x1, y1}); dr[x1][y1]=dr[x][y]+1; } } } vector

v; for(int i=0; id[rb][cb]+1){ cout<<2*d[rb][cb]<2){ cout<<2*d[rb][cb]+2<e[x][y]+1){ que.push({x1, y1}); e[x1][y1]=e[x][y]+1; } } } if(e[rb][cb]