#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 i_diff = abs(i_start - i_end); int j_diff = j_start - j_end; if (i_diff % 2 == 1 || (j_diff - i_diff)%2 == 1) { cout << "Impossible\n"; return; } cerr << i_diff < steps; int sidesteps = (abs(j_diff)- i_diff/2)/2; if (sidesteps < 0) sidesteps = 0; for (int i=0; i 0) { steps.push_back(L); cerr << "L\n"; } else { steps.push_back(R); cerr << "R\n"; } } if (j_diff > 0) { j_diff -= 2*sidesteps; } else { j_diff += 2*sidesteps; } 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; }