結果

問題 No.179 塗り分け
ユーザー Akidai16
提出日時 2020-03-29 04:04:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 941 bytes
コンパイル時間 1,694 ms
コンパイル使用メモリ 171,688 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-02 13:00:39
合計ジャッジ時間 3,839 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 34 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

int main() {
    int H, W;
    cin>>H>>W;
    vector<string> S(H);
    REP(i,0,H) cin >> S[i];
    vector<vector<bool>> Black(H,vector<bool>(W, false));
    REP(i,0,H){
        REP(j,0,W){
            if(S[i][j]=='#') Black[i][j] = true;
        }
    }
    bool ans = false;

    REP(i, 0, H){
        REP(j, 0, W){
            if(i== 0 && j == 0)  continue;
            vector<vector<bool>> Used(H,vector<bool>(W, false));
            REP(k, 0, H-i){
                REP(l, 0, W-j){
                    if(S[k][l] =='#' && S[k+i][l+j] == '#' && !Used[k][l] && !Used[k+i][l+j]){
                        Used[k+i][l+j] = true;
                        Used[k][l] = true;
                    }
                }
            }
            if(Black == Used) ans = true;
        }
    }
    cout << (ans ? "YES" : "NO" ) << endl;
}
0