#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; #define MAXD 8 #define MAXN 25 #define SIZE 625 #define queue_init (head=tail=0) #define queue_is_empty (head==tail) #define en_queue(x) (squeue[tail++]=(x)) #define de_queue (squeue[head++]) #define rint register int typedef struct point { int x,y; } point; int N,sx,sy,ex,ey,head,tail; int matrix[MAXN][MAXN]; int Ans[MAXN][MAXN]; int dx[MAXD],dy[MAXD]; struct point squeue[SIZE]; int d[2]={1,-1}; void dump() { for (rint i=0;i=N || j<0 || j>=N || matrix[i][j]>=0) continue; matrix[in.x=i][in.y=j]=matrix[out.x][out.y]+1; en_queue(in); } } return -1; } int main(){ cin>>N; sx=sy=0;ex=ey=N-1; for (rint i=1;i