能帮我看看代码吗555
#include <bits/stdc++.h>
using namespace std;
struct pos {
int x, y;
pos(int ax = 0, int ay = 0) {
x = ax; y = ay;
}
};
const int maxn = 405;
queue<pos> Q;
int ans[maxn][maxn];
int n, m, sx, sy;
int walk[8][2] = {{2, 1}, {1, 2}, {-1, 2}, {-2, 1},{-2, -1}, {-1, -2}, {1, -2}, {2, -1}};
int main() {
cin >> n >> m >> sx >> sy;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
ans[i][j] = 0;
}
}
Q.push(pos(sx, sy));
ans[sx][sy] = 0;
while (!Q.empty()){
pos now = Q.front();
Q.pop();
for (int k = 0; k < 8; k++) {
int x = now.x + walk[k][0],y = now.y + walk[k][1];
int d = ans[now.x][now.y];
if(x < 1 || x > n || y < 1 || y > m || ans[x][y] != -1) continue;
ans[x][y]++;
Q.push(pos(x, y));
}
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++)
printf("%-5d",ans[i][j]);
puts("\n");
}
return 0;
}