#include using namespace std; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. int temp; temp=i_start; i_start=j_start; j_start=temp; temp=i_end; i_end=j_end; j_end=temp; int b = j_end-j_start; int a = i_end-i_start; if(b%2!=0) { cout<<"Impossible\n"; return ; } if(abs(b/2-a)%2!=0) { cout<<"Impossible\n"; return ; } vector ab; while(j_start!=j_end) { if(j_start>j_end && i_start>i_end) { ab.push_back("UL "); i_start--; j_start-=2; continue; } if(j_start>j_end && i_start<=i_end) { ab.push_back("UR "); i_start++; j_start-=2; continue; } if(j_start<=j_end && i_start>i_end) { ab.push_back("LL "); i_start--; j_start+=2; continue; } if(j_start<=j_end && i_start<=i_end) { ab.push_back("LR "); i_start++; j_start+=2; continue; } } while(i_start!=i_end) { if(i_start>i_end) { ab.push_back("L "); i_start-=2; continue; } if(i_start<=i_end) { ab.push_back("R "); i_start+=2; continue; } } cout<> 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; }