#include #include #include #include #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 res=0,i,j; vector mov; if(i_end>i_start) { while((j_end>j_start)&&(i_end>i_start)) { mov.push_back("LR "); res=res+1; i_start+=2; j_start+=1; } while((j_endi_start)) { mov.push_back("LL "); res=res+1; i_start+=2; j_start-=1; } while((j_end==j_start)&&(i_end>i_start)) { mov.push_back("LR "); mov.push_back("LL "); res+=2; i_start+=4; } } if(i_endj_start)) { mov.push_back("UR "); res=res+1; i_start-=2; j_start+=1; } while((i_endi_start)) { mov.push_back("UR "); mov.push_back("UL "); res+=2; i_start-=4; } } if(i_end==i_start) { while(j_end>j_start) { mov.push_back("R "); res=res+1; j_start+=2; } while(j_end>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; }