結果

問題 No.179 塗り分け
ユーザー h_noson
提出日時 2016-02-18 12:02:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 891 bytes
コンパイル時間 642 ms
コンパイル使用メモリ 65,480 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-03 03:14:41
合計ジャッジ時間 2,228 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 34 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (int i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (int i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s;
    s.resize(h);
    rep (i,h) cin >> s[i];

    bool found, yes = false;
    rep (di,h) rep (dj,w) {
        found = true;
        vector<string> b = s;
        if (di == 0 && dj == 0)
            continue;
        rep (i,h) rep (j,w) {
            if (b[i][j] == '#') {
                if (i+di < h && j+dj < w && b[i+di][j+dj] == '#')
                    b[i+di][j+dj] = '.';
                else
                    found = false;
            }
        }
        yes |= found;
    }
    if (yes)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}
0