#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 bendyI = 2; int bendyJ = 1; int straightJ = 2; int tmpI = i_start; int tmpJ = j_start; int bendULCount=0; int bendURCount=0; int bendLLCount=0; int bendLRCount=0; int straightLCount=0; int straightRcount=0; while((tmpI>=0&&tmpJ>=0)&&(tmpI!=i_end)){ //tmpJ!=j_end if(i_endtmpI&&j_endtmpJ){ tmpI-=bendyI; tmpJ+=bendyJ; bendURCount++; } else if(i_end>tmpI&&j_end>=tmpJ){ tmpI+=bendyI; tmpJ+=bendyJ; bendLRCount++; } } if(tmpJ==j_end&&tmpI!=i_end){ cout << "Impossible" << endl; } else if(tmpJ<0||tmpI<0){ cout << "Impossible" << endl; } else if(tmpI==i_end){ while(tmpJ>=0&&tmpJ!=j_end){ if(j_endtmpJ){ tmpJ+=straightJ; straightRcount++; } } if(tmpJ!=j_end){ cout << "Impossible" << endl; } else{ cout << bendULCount+bendURCount+straightRcount+bendLRCount+bendLLCount+straightLCount << endl; 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; }