#include #include #define ll long long int #define pb push_back #define mp make_pair using namespace std; int n; int a1[]={-2,-2,0,2,2,0}; int a2[]={-1,1,2,1,-1,-2}; string st[]={"UL","UR","R","LR","LL","L"}; int b1[]={1,-1,0,0}; int b2[]={0,0,1,-1}; int a[201][201]={0}; int o[201][201]={0}; int p[201][201]={0}; vector v; //vector < vector > vv; queue < pair > q; int f=0; //int mpos=0,m=10001; bool isvalid(int x,int y) { if(x<0 || y<0 || x>=n || y>=n) return false; return true; } void bfs(int x,int y,int ss,int dd) { q.push(mp(x,y)); while(!q.empty()) { int s=q.front().first; int d=q.front().second; q.pop(); if(s==ss && y==dd) { f=1; break; } for(int i=0;i<4;i++) { if(s+b1[i]==ss && d+b2[i]==dd) { f=2; break; } } for(int i=0;i<6;i++) { if(isvalid(s+a1[i],d+a2[i]) && a[s+a1[i]][d+a2[i]]==0 && ((s+a1[i])!=x || (d+a2[i])!=y)) { a[s+a1[i]][d+a2[i]]=1+a[s][d]; q.push(mp(s+a1[i],d+a2[i])); o[s+a1[i]][d+a2[i]]=s; p[s+a1[i]][d+a2[i]]=d; } } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int sx,sy,ex,ey; cin>>n; cin>>sx>>sy>>ex>>ey; a[sx][sy]=0; o[sx][sy]=-1; p[sx][sy]=-1; bfs(sx,sy,ex,ey); if(f!=2) { //cout<=0;i--) cout<