#ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int64; typedef unsigned long long uint64; #define two(X) (1<<(X)) #define twoL(X) (((int64)(1))<<(X)) #define contain(S,X) (((S)&two(X))!=0) #define containL(S,X) (((S)&twoL(X))!=0) const double pi=acos(-1.0); const double eps=1e-11; template inline void ckmin(T &a,T b){if(b inline void ckmax(T &a,T b){if(b>a) a=b;} template inline T sqr(T x){return x*x;} typedef pair ipair; #define SIZE(A) ((int)A.size()) #define LENGTH(A) ((int)A.length()) #define MP(A,B) make_pair(A,B) #define PB(X) push_back(X) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,a) for(int i=0;i<(a);++i) #define ALL(A) A.begin(),A.end() const int dx[]={-2,-2,0,2,2,0}; const int dy[]={-1,1,2,1,-1,-2}; const string ds[]={"UL", "UR", "R", "LR", "LL", "L"}; int d[256][256]; 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. memset(d,255,sizeof(d)); vector q; d[i_end][j_end]=0; q.emplace_back(i_end,j_end); REP(cl,SIZE(q)) { int x=q[cl].first; int y=q[cl].second; REP(dir,6) { int x2=x+dx[dir]; int y2=y+dy[dir]; if (x2>=0 && x2=0 && y20) REP(dir,6) { int x2=x0+dx[dir]; int y2=y0+dy[dir]; if (x2>=0 && x2=0 && y2> 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; }