#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) std::cout<<(p)<>H>>W; rep(i,50)rep(k,50)b[i][k]=-1; string str; int max = 0; rep(i,H){ cin>>str; rep(k,W){ if(str[k] == '#'){ b[i][k] = 1; ++max; } else{ b[i][k] = 0; } } } // if(max%2==1 || max==0){//少なくとも1塗る:2マス以上黒、0のYESは無い P("NO"); return 0; } // int count = 0; for(int dx = -W+1; dx= 0 && c[dy + pos/W][dx + pos%W] == 1){ c[dy + pos/W][dx + pos%W] = 0;//青 ++count; } else{ break; } } } if(count == max/2){ P("YES"); return 0; } } } P("NO"); return 0; }