#include<bits/stdc++.h> usingnamespace std; typedef pair<int,int > PII; constint N=1e2+7; int g[N][N]; int d[N][N];
int n,m; int dx[4]={-1,0,1,0}, dy[4]={0,1,0,-1}; intbfs() {
queue<PII> q;
q.push({0,0}); // STRATR OF DATA;
memset(d,-1,sizeof d); d[0][0]=0; while(q.size()) { PII t=q.front(); //get the head of t; 取队头的元素 q.pop(); //POP for(int i=0;i<4;i++) { int x=t.first+dx[i]; int y=t.second+dy[i];