#include<bits/stdc++.h>
using namespace std;
struct pos{
int x;
int y;
};
queue<pos>q;
int mp[405][405];
bool vis[405][405];
int dx[8]={-2,-2,2,2,1,-1,1,-1};
int dy[8]={-1,1,-1,1,2,-2,-2,2};
int n,m,x,y;
void bfs(int xx,int yy){
q.push((pos){x,y});
vis[x][y]=true;
while(!q.empty()){
int x=q.front().x;
int y=q.front().y;
q.pop();
for(int i=0;i<8;i++){
int tx=x+dx[i];
int ty=y+dy[i];
if(tx<=0||tx>n||ty<=0||ty>m||vis[tx][ty]==true)continue;
mp[tx][ty]=mp[x][y]+1;
vis[tx][ty]=true;
q.push((pos){tx,ty});
}
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>n>>m>>x>>y;
bfs(x,y);
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(mp[i][j]==0&&i!=x&&j!=y){
printf("%-5d",-1);
}
else printf("%-5d",mp[i][j]);
}
cout<<endl;
}
return 0;
}
不知道错哪qwq