結果

問題 No.179 塗り分け
ユーザー sugarrr
提出日時 2018-03-03 15:15:04
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,236 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 80,404 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-24 12:19:38
合計ジャッジ時間 2,229 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 33 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
#define inf 100000000/*10^8*/
#define rep(i,l,r) for(int i=l;i<=r;i++)
const double EPS=1E-8;

////////////////////////////////////////
int h,w;
char p[50][50+1];
bool flag=false;
void solve(int x,int y){
    char m[h][51];
    rep(i,0,h-1)rep(j,0,w-1)m[i][j]=p[i][j];
    rep(i,0,h-1)rep(j,0,w-1){
        if(m[i][j]=='#'){
            m[i][j]='.';
            if(i+x>=h||j+y>=w)return;
            if(m[i+x][j+y]=='.')return;
            m[i+x][j+y]='.';
        }
    }
    bool flg=true;
    rep(i,0,h-1)rep(j,0,w-1)if(m[i][j]!='.')flg=false;
    if(flg){
    cout<<"YES";
    flag=true;
    }
}



int main(){
    cin>>h>>w;
    rep(i,0,h-1)cin>>p[i];
    rep(i,0,h-1){
        rep(j,0,w-1){
            if(!flag)solve(i,j);
        }
    }
    if(!flag)cout<<"NO";
    
    return 0;
}
0