#include using namespace std; struct cell { int x, y; int dis; vector< int > path; }; bool isInside(int x, int y, int N) { if (x >= 0 && x < N && y >= 0 && y < N) return true; return false; } void printShortestPath(int N, int i_start, int j_start, int i_end, int j_end) { vector< int > path; int knightPos[]={ i_start , i_end }; int targetPos[]={ j_start , j_end }; int dy[] = { -1 , 1 , 2 , 1 , -1 , -2 }; int dx[] = { -2 , -2 , 0 , 2 , 2 , 0 }; string pos[]={"UL","UR","R","LR","LL","L"}; queue q; cell t; t.x=knightPos[0]; t.y=knightPos[1]; t.path={}; q.push(t); int x, y; bool visit[N + 1][N + 1]; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) visit[i][j] = false; visit[knightPos[0]][knightPos[1]] = true; while (!q.empty()) { t = q.front(); q.pop(); visit[t.x][t.y] = true; if (t.x == targetPos[0] && t.y == targetPos[1]){ cout<> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> i_end >> j_start >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }