結果

問題 No.179 塗り分け
ユーザー NacoNaco
提出日時 2019-10-20 01:40:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,335 bytes
コンパイル時間 1,586 ms
コンパイル使用メモリ 169,252 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-15 06:54:22
合計ジャッジ時間 7,094 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 1 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 9 ms
6,676 KB
testcase_06 AC 4 ms
6,676 KB
testcase_07 AC 18 ms
6,676 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 41 ms
6,676 KB
testcase_11 AC 37 ms
6,676 KB
testcase_12 RE -
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 1 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 27 ms
6,676 KB
testcase_19 AC 26 ms
6,676 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 23 ms
6,676 KB
testcase_24 AC 26 ms
6,676 KB
testcase_25 AC 15 ms
6,676 KB
testcase_26 AC 38 ms
6,676 KB
testcase_27 RE -
testcase_28 AC 71 ms
6,676 KB
testcase_29 RE -
testcase_30 AC 101 ms
6,676 KB
testcase_31 RE -
testcase_32 AC 79 ms
6,676 KB
testcase_33 RE -
testcase_34 AC 93 ms
6,676 KB
testcase_35 RE -
testcase_36 AC 2 ms
6,676 KB
testcase_37 AC 2 ms
6,676 KB
testcase_38 AC 2 ms
6,676 KB
testcase_39 AC 1 ms
6,676 KB
testcase_40 AC 6 ms
6,676 KB
testcase_41 AC 1 ms
6,676 KB
testcase_42 AC 1 ms
6,676 KB
testcase_43 AC 5 ms
6,676 KB
testcase_44 AC 19 ms
6,676 KB
testcase_45 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    int H,W; cin >> H >> W;
    char s[H][W];
    for(int i=0;i<H;i++){
        string x; cin >> x;
        for(int j=0;j<W;j++){
            s[i][j]=x[j];
        }
    }
    for(int i=-H;i<H;i++){
        for(int j=-W;j<W;j++){
            if(i==0&&j==0) continue;
            bool flag=true;
            bool check[H][W]={};
            int cnt=0;
            for(int k=0;k<H;k++){
                for(int l=0;l<W;l++){
                    if(s[k][l]=='.') continue;
                    cnt++;
                    if(check[k][l]) continue;
                    if(k+i>=H||k+i<0||l+j<0||l+j>=W){
                        flag=false;
                    }
                    if(check[k][l]==false&&s[k][l]=='#'){
                        check[k][l]=true;
                        if(s[k+i][l+j]=='#'&&check[k+i][l+j]==false){
                            check[k+i][l+j]=true;
                            continue;
                        }
                    }
                    flag=false;
                }
                
            }
            if(cnt==0) flag=false;
            if(flag){
                //cout << i << j << endl;
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}
0