結果

問題 No.179 塗り分け
ユーザー hogeover30hogeover30
提出日時 2018-07-10 17:28:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 732 bytes
コンパイル時間 2,302 ms
コンパイル使用メモリ 202,344 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-11 13:09:51
合計ジャッジ時間 5,692 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,356 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 12 ms
4,352 KB
testcase_06 AC 4 ms
4,348 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 3 ms
4,348 KB
testcase_10 AC 18 ms
4,352 KB
testcase_11 AC 16 ms
4,348 KB
testcase_12 AC 66 ms
4,352 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 2 ms
4,352 KB
testcase_17 WA -
testcase_18 AC 76 ms
4,352 KB
testcase_19 AC 71 ms
4,376 KB
testcase_20 AC 104 ms
4,348 KB
testcase_21 AC 64 ms
4,348 KB
testcase_22 AC 61 ms
4,352 KB
testcase_23 AC 36 ms
4,348 KB
testcase_24 AC 65 ms
4,348 KB
testcase_25 AC 37 ms
4,348 KB
testcase_26 AC 50 ms
4,352 KB
testcase_27 AC 149 ms
4,352 KB
testcase_28 AC 99 ms
4,352 KB
testcase_29 AC 178 ms
4,352 KB
testcase_30 AC 51 ms
4,352 KB
testcase_31 AC 198 ms
4,352 KB
testcase_32 AC 58 ms
4,352 KB
testcase_33 AC 158 ms
4,348 KB
testcase_34 AC 77 ms
4,348 KB
testcase_35 AC 173 ms
4,376 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 1 ms
4,356 KB
testcase_38 AC 1 ms
4,348 KB
testcase_39 AC 1 ms
4,352 KB
testcase_40 AC 2 ms
4,352 KB
testcase_41 AC 1 ms
4,348 KB
testcase_42 AC 1 ms
4,352 KB
testcase_43 AC 4 ms
4,348 KB
testcase_44 AC 23 ms
4,348 KB
testcase_45 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main()
{
    int H, W; cin>>H>>W;
    vector<string> S(H);

    int N=0;
    for(auto& e: S) {
        cin>>e;
        N+=count(begin(e), end(e), '#');
    }

#define REP(i, a, b) for(int i=a; i<b; ++i)
    
    REP(r, -H, H) REP(c, -W, W) if (c|r) {
        auto T=S;
        int red=0, blue=0;
        REP(i, 0, H) REP(j, 0, W) {
            if (!(T[i][j]=='#' && 0<=i+r && i+r<H && 0<=j+c && j+c<W)) continue;
            if (T[i][j]==T[i+r][j+c]) {
                T[i][j]=0;
                T[i+r][j+c]=1;
                ++red;
                ++blue;
            }
        }
        if (red==blue && N==red+blue)
            return !printf("YES\n");
    }
    puts("NO");
}
0