#include using namespace std; int INF = 1 << 30; int dy[6] = {-2,-2,0,2,2,0}; int dx[6] = {-1,1,2,1,-1,-2}; vector< vector< vector > > path(200,vector< vector >(200)); vector< vector< int > >dist(200, vector< int >(200,INF) ); string getMove(int i){ if(i == 0){ return "UL"; }else if(i == 1){ return "UR"; }else if(i == 2){ return "R"; }else if(i == 3){ return "LR"; }else if(i == 4){ return "LL"; }else{ return "L"; } } string printVector(vectortempPath){ string ret = ""; for(int k=0;kq; q.push((i_start*n)+j_start); while(!q.empty()){ int curNode = q.front();q.pop(); int iCur = curNode/n; int jCur = curNode%n; //cout<=0 && iAdj < n && jAdj >=0 && jAdj < n && dist[iAdj][jAdj] > dist[iCur][jCur] + 1){ dist[iAdj][jAdj] = dist[iCur][jCur] + 1; path[iAdj][jAdj] = path[iCur][jCur]; path[iAdj][jAdj].push_back(k); q.push((iAdj*n)+jAdj); } } } return dist[iEnd][jEnd]; } void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { int minMoves = calculateShortestPath(n,i_start,j_start,i_end,j_end); if(minMoves == INF){ cout<<"Impossible"<> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }