結果

問題 No.179 塗り分け
ユーザー なおなお
提出日時 2015-04-06 00:23:12
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,296 bytes
コンパイル時間 1,700 ms
コンパイル使用メモリ 164,168 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 11:27:03
合計ジャッジ時間 3,895 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 3 ms
6,944 KB
testcase_07 WA -
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 17 ms
6,944 KB
testcase_11 AC 15 ms
6,940 KB
testcase_12 AC 62 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 33 ms
6,940 KB
testcase_19 AC 31 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 63 ms
6,944 KB
testcase_23 AC 22 ms
6,944 KB
testcase_24 AC 63 ms
6,944 KB
testcase_25 AC 31 ms
6,940 KB
testcase_26 AC 33 ms
6,940 KB
testcase_27 AC 92 ms
6,944 KB
testcase_28 AC 54 ms
6,940 KB
testcase_29 AC 107 ms
6,940 KB
testcase_30 AC 27 ms
6,940 KB
testcase_31 AC 119 ms
6,940 KB
testcase_32 AC 32 ms
6,944 KB
testcase_33 AC 103 ms
6,940 KB
testcase_34 AC 43 ms
6,940 KB
testcase_35 AC 110 ms
6,940 KB
testcase_36 AC 2 ms
6,940 KB
testcase_37 AC 2 ms
6,944 KB
testcase_38 AC 2 ms
6,940 KB
testcase_39 AC 1 ms
6,940 KB
testcase_40 AC 2 ms
6,940 KB
testcase_41 AC 2 ms
6,940 KB
testcase_42 AC 2 ms
6,940 KB
testcase_43 AC 4 ms
6,940 KB
testcase_44 AC 15 ms
6,940 KB
testcase_45 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define REP(i, n)           for(int(i)=0;(i)<(n);++(i))
#define FOR(i, f, t)        for(int(i)=(f);(i)<(t);(++i))
#define RREP(i, n)          for(int(i)=(n)-1;(i)>=0;--(i))
const int MOD = int(1e9+7);


int main(){
    do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0);
    int H,W;
    cin >> H >> W;

    vector<string> v;
    REP(i,H){
        string s; cin >> s;
        v.push_back(s);
    }
    int t = 0;
    REP(y,H)REP(x,W){
        if(v[y][x] == '#') t++;
    }
    if(t%2){
        cout << "NO" << endl;
        return 0;
    }

    for(int y = -H+1; y < H; y++) for(int x = -W+1; x < W; x++){
        if(y == 0 && x <= 0) continue;
        vector<string> w = v;
        int c = 0;
        REP(y2,H)REP(x2,W){
            int x3 = x2+x, y3 = y2+y;
            if(x3<0||y3<0||x3>=W||y3>=H) continue;
            if(w[y2][x2] == '#' && w[y3][x3] == '#'){
                w[y2][x2] = w[y3][x3] = '$';
                c += 2;
            }
        }
        if(t == c){
            cerr << x << ":" << y << endl;
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;
    return 0;
}
0