#include using namespace std; void printShortestPath2(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. if(i_start==i_end&&j_start==j_end) return; if(i_start>i_end&&(j_start>j_end||(j_start==j_end&&j_start!=0))){ cout<<"UL ";i_start-=2;j_start--; } else if(i_start>i_end&&(j_startabs(i_start-i_end)){ cout<<"R ";j_start+=2; } else if(i_startj_end||(j_start==j_end&&j_start!=0))){ cout<<"LL ";i_start+=2;j_start--; } else if(i_start==i_end&&j_start>j_end){ cout<<"L ";j_start-=2; } printShortestPath2(n,i_start,j_start,i_end,j_end); } 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. if(abs(i_end-i_start)%2||(abs(i_end-i_start)%4==2&&abs(j_start-j_end)%2==0)||(abs(i_end-i_start)%4==0&&abs(j_start-j_end)%2==1)){ cout<<"Impossible\n";return; } else{ int z = abs(i_end-i_start)/2; int y = abs(j_start-j_end)-z; y/=2; y=max(0,y); 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; }