#include #include using namespace std; void printShortestPath(int n, int is, int js, int ie, int je) { // Print the distance along with the sequence of moves. int im,jm,s=0;int ki; int ar[200];int a=0; int flag=0; if(ie>is) im=ie-is; else im=is-ie; if(je>js) jm=je-js; else jm=js-je; s=im+jm; if(ie==is || js==je) { if(ie==is && je>js) ki=(je-js)/2; else ki=(js-je)/2; if(je==js && ie>is) ki=(ie-is)/2; else ki=(is-ie)/2; flag=2; } else { for(int i=0;i<=im/2;i++) { for(int j=0;j<=jm/2;j++) { if(((3*i)+(2*j))==s) { flag=1; ar[a]=i; ar[a+1]=j; a=a+2; } } } } if(flag==0) { cout<<"Impossible"; } else if(flag==1) { int mx3=ar[0];int pos=0; for(int i=0;imx3) { mx3=ar[i]; pos=i; } } int ans=ar[pos]+ar[pos+1]; cout<is && je>js) { for(int i=0;ijs) { for(int i=0;iis && jeis && je==js) { for(int i=0;ijs && ie==is) { 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; }