int a[150][150],tmp[150][150],sum,n,m;
int X[] = {0,-1,1,0};
int Y[] = {-1,0,0,1};
void baoli_first_search(int idx,int idy){
queue<PII> p;
p.push({idx,idy});
tmp[idx][idy] = 1;
while(!p.empty()){
PII q = p.front();
p.pop();
for(int i = 0;i<4;i++){
int x = q.first+X[i],y = q.second+Y[i];
if(x<1||x>n||y<1||y>m||tmp[x][y]||a[x][y]==0) continue;
p.push({x,y});
tmp[x][y]=1;
}
}
}