#include using namespace std; int H,W; int A[3000][3000]; void dfs(int x, int y){ A[y][x] = 0; int nx, ny; nx=x; ny=y+1; if(ny=0 && A[ny][nx]==1) dfs(nx,ny); nx=x-1; ny=y; if(nx>=0 && A[ny][nx]==1) dfs(nx,ny); nx=x+1; ny=y; if(nx> H >> W; for(int j=0; j> A[j][i]; solve(); }