刘荣超

#include using namespace std; #define ll long long const ll N=105; ll s[N][N],o[N][N],D[N][N],n,l=0; void BFS(ll a,ll b){ ll st[4][2]={{1,0},{-1,0},{0,1},{0,-1}},x,y; queue q; D[a][b]=0; o[a][b]=1; q.push(a); q.push(b); while(!q.empty()){ x=q.front(); q.pop(); y=q.front(); q.pop(); printf("(%d, %d)\n",x,y); l++; for(ll k=0;k<4;k++){ ll u=st[k][1]+x,v=st[k][0]+y; if(u>=n||u<0||v>=n||v<0|| o[u][v]==1||s[u][v]==1){ continue; } o[u][v]=1; D[u][v]=D[x][y]+1; q.push(u); q.push(v); } } } int main(){ cin>>n; for(ll i=0;i>s[i][j]; } } BFS(0,0); cout<