結果

問題 No.179 塗り分け
ユーザー 👑 nu50218nu50218
提出日時 2019-09-02 22:54:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 969 bytes
コンパイル時間 3,253 ms
コンパイル使用メモリ 171,144 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-22 18:35:57
合計ジャッジ時間 4,324 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 15 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 8 ms
4,380 KB
testcase_11 AC 8 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 9 ms
4,380 KB
testcase_19 AC 8 ms
4,376 KB
testcase_20 AC 8 ms
4,376 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 9 ms
4,376 KB
testcase_24 WA -
testcase_25 AC 10 ms
4,380 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 10 ms
4,376 KB
testcase_30 WA -
testcase_31 AC 8 ms
4,376 KB
testcase_32 AC 10 ms
4,376 KB
testcase_33 AC 10 ms
4,376 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 2 ms
4,376 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 2 ms
4,376 KB
testcase_45 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

bool check(vector<vector<char>> S, int H, int W, int x, int y) {
    bool ans;
    bool used[H][W] = {};
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (!used[i][j] && S[i][j] == '#') {
                if (!(i + x < H && j + y < W)) return false;
                if (used[i + x][j + y]) return false;
                used[i][j] = used[i + x][j + y] = true;
                ans = true;
            }
        }
    }
    return ans;
}

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H, vector<char>(W));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> S[i][j];
        }
    }
    bool ans = false;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (i == 0 && j == 0) continue;
            ans |= check(S, H, W, i, j);
        }
    }
    cout << (ans ? "YES" : "NO") << endl;
}
0