結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 WA -
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 2 ms
4,352 KB
testcase_10 AC 19 ms
4,352 KB
testcase_11 AC 16 ms
4,348 KB
testcase_12 AC 69 ms
4,352 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 WA -
testcase_18 AC 75 ms
4,348 KB
testcase_19 AC 51 ms
4,348 KB
testcase_20 AC 103 ms
4,348 KB
testcase_21 AC 65 ms
4,352 KB
testcase_22 WA -
testcase_23 AC 38 ms
4,348 KB
testcase_24 AC 67 ms
4,348 KB
testcase_25 AC 38 ms
4,352 KB
testcase_26 AC 51 ms
4,352 KB
testcase_27 AC 148 ms
4,348 KB
testcase_28 AC 100 ms
4,348 KB
testcase_29 AC 178 ms
4,348 KB
testcase_30 AC 51 ms
4,348 KB
testcase_31 WA -
testcase_32 AC 58 ms
4,352 KB
testcase_33 WA -
testcase_34 AC 73 ms
4,352 KB
testcase_35 WA -
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 1 ms
4,352 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 1 ms
4,352 KB
testcase_41 AC 1 ms
4,352 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

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 (S[i][j]==S[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