#include #include #include #define mp std::make_pair typedef std::pair P; typedef std::pair Q; const int dx[4] = {-1, 1, 0, 0}, dy[4] = {0, 0, -1, 1}; int W, H; std::string map[20]; int label[20][20]; bool used[20][20]; std::queue q; void dfs(int y, int x, int l){ if(!(0 <= y && y < H && 0 <= x && x < W)){return;} if(map[y][x] != '.'){return;} if(used[y][x]){return;} used[y][x] = true; if(l == 1){q.push(mp(0, mp(y, x)));} label[y][x] = l; for(int i=0;i<4;i++){ dfs(y+dy[i], x+dx[i], l); } } int main(){ std::cin >> W >> H; for(int i=0;i> map[i]; } { int x = 0; for(int i=0;i