#include #include using namespace std; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { int i_sub = i_end - i_start ; int j_sub = j_end - j_start ; int i_temp = i_start; int j_temp = j_start; vector results(6); int impossible=0; int move_number=0; // UL, UR, R, LR, LL, L. vector move_array(n*n);//(n); for(int atama=0;atama<(n*n);atama++){ move_array[atama]=10; } vector i_temp_arr(6); vector j_temp_arr(6); int min=0; do{ i_sub = i_end - i_start ; j_sub = j_end - j_start ; if(i_sub==0 && j_sub==0){ impossible=2; cout << move_number << endl; for(int t=0;tresults[j]){ min=results[j]; move = j; i_start = i_temp_arr[j]; j_start = j_temp_arr[j]; } else if(min==results[j]){ if(moven-1 || i_start<0 ||j_start>n || j_start<0){ impossible=1; } move_array[move_number]=move; move_number++; } }while(impossible==0); if(impossible==1){ cout << "Impossible" << endl; } } int main() { int n; cin >> 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; }