#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 row_0 = i_start ; int col_0 = j_start ; int row_1 = i_end ; int col_1 = j_end ; int col_diff = j_start - j_end ; int row_diff = i_start - i_end ; if(row_diff %2 != 0){ printf("Impossible\n"); return; } if(col_diff == 0 && row_diff != 0){ if(row_diff%4 != 0){ printf("Impossible\n"); return; } printf("%d\n", abs(row_diff/2)); while(row_diff){ if(row_diff > 0){ cout<< "UL UR "; row_diff -= 4; }else{ cout<< "LR LL "; row_diff += 4; } } cout<< "\n"; return; } std::vector S; while (row_diff){ if(row_diff > 0){ row_diff -= 2; if(col_diff > 0){ col_diff -= 1; S.push_back("UL"); }else{ col_diff += 1; S.push_back("UR"); } }else{ row_diff += 2; if(col_diff > 0){ col_diff -= 1; S.push_back("LL"); }else{ col_diff += 1; S.push_back("LR"); } } } if(col_diff %2 != 0){ cout << "Impossible\n"; return; } while(col_diff){ if(col_diff > 0){ col_diff -= 2; S.push_back("L"); }else{ col_diff += 2; S.push_back("R"); } } std::cout<< S.size() << "\n"; for(int i=0; i> 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; }