acmicpc.net 7562(BFS), 3055(BFS), 7576,7569(BFS)
https://www.acmicpc.net/problem/7562 #include #include #include #include using namespace std; int t,n,c[2],m[2]; int _y[]={-2,-1,1,2,2,1,-1,-2}; int _x[]={1,2,2,1,-1,-2,-2,-1}; int bfs(int c[2],int m[2]) { int visited[300][300]={0,}; queue q; vector t; t.push_back(c[0]); t.push_back(c[1]); t.push_back(0); q.push(t); while(!q.empty()) { vector p = q.front(); q.pop(); if(p[0]==m[0] && p[1]==m[1]) ..