結果

問題 No.179 塗り分け
ユーザー zaki_johozaki_joho
提出日時 2018-12-23 21:29:58
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,780 bytes
コンパイル時間 2,829 ms
コンパイル使用メモリ 167,492 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-26 02:37:48
合計ジャッジ時間 4,754 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int H, W;
    cin >> H >> W;
    vector<string> s(H);
    for (int i = 0; i < H; i++)
        cin >> s[i];
    bool f = false;
    vector<vector<bool>> used(H, vector<bool>(W, false));
    for (int dx = 0; dx < H; dx++)
    {
        for (int dy = 0; dy < W; dy++)
        {
            if (dx == 0 && dy == 0)
                continue;
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if (s[i][j] == '.')
                        used[i][j] = true;
                    else
                        used[i][j] = false;
                }
            }
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if (used[i][j])
                        continue;
                    int nx = i + dx, ny = j + dy;
                    if (nx < 0 || H <= nx || ny < 0 || W <= ny)
                        continue;
                    if (used[nx][ny])
                        continue;
                    used[i][j] = used[nx][ny] = true;
                }
            }
            bool tmp = true;
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if (!used[i][j])
                        tmp = false;
                }
            }
            if (tmp)
                f = true;
        }
    }
    cout << (f ? "YES" : "NO") << endl;
}
0