#include using namespace std; int i_start; int j_start; int i_end; int j_end; int u,d,r,l; void refresh(){ u=0;d=0;r=0;l=0; } int next(int x, int y,int x2,int y2){ int cas=0; if(x-x2>0){ u=abs(x-x2); if(y-y2>0){ l=abs(y-y2); cas=1; } else if(y-y2<0){ r=abs(y-y2); cas=2; } else{ cas=1; } } else if(x-x2<0){ d=abs(x-x2); if(y-y2>0){ l=abs(y-y2); cas=5; } else if(y-y2<0){ r=abs(y-y2); cas=4; } else{ cas=4; } } else if(x-x2==0){ if(y-y2>0){ l=abs(y-y2); cas=6; } else if(y-y2<0){ r=abs(y-y2); cas=3; } } if(u==0 && d==0 && l==0 && r==0){ cas=0; return cas; } if(u==0 && d==0){ if(r==1||l==1){ cas=-1; } } else if(r==0 && l==0){ if(u==1||d==1){ cas=-1; } } return cas; } void printShortestPath(int n, int x1, int y1, int x2, int y2) { int ar[n][n]; vector< string > vec; while(true){ //cout<<"("<> n; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }