結果

問題 No.179 塗り分け
ユーザー heabiheabi
提出日時 2020-11-21 14:48:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,436 bytes
コンパイル時間 1,685 ms
コンパイル使用メモリ 174,024 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-30 21:52:03
合計ジャッジ時間 4,144 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
#define vvvvll vector<vector<vector<vector<ll>>>>
#define vvvll vector<vector<vector<ll>>>
#define vvll vector<vector<ll>>
#define vll vector<ll>
#define pqll priority_queue<ll>
#define pqllg priority_queue<ll, vector<ll>, greater<ll>>

constexpr ll INF = (1ll << 60);
constexpr ll mod = 1000000007;  // 998244353;
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

void pt_vvll(vvll v) {
    ll vs = v.size(), vs0 = v[0].size();
    rep(i, vs) {
        rep(j, vs0) {
            cout << v[i][j];

            if (j != vs0 - 1)
                cout << " ";
            else
                cout << "\n";
        }
    }
}
void pt_vll(vll v) {
    ll vs = v.size();
    rep(i, vs) {
        cout << v[i];
        if (i == vs - 1)
            cout << "\n";
        else
            cout << " ";
    }
}

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

    ll H, W;
    cin >> H >> W;
    vector<string> s(H);
    rep(i, H) { cin >> s[i]; }

    rep(dy, H) {
        rep(dx, W) {
            if (!dy && !dx) continue;
            vector<vector<bool>> seen(H, vector<bool>(W));
            // bool bre = false;
            bool can = true;
            rep(i, H) {
                rep(j, W) {
                    if (seen[i][j]) continue;
                    if (i + dy < H && j + dx < W && s[i][j] == '#' &&
                        s[i + dy][j + dx] == '#' && !seen[i + dy][j + dx]) {
                        seen[i][j] = true;
                        seen[i + dy][j + dx] = true;
                    } /*else {
                        bre = true;
                        can = false;
                        break;
                    }*/
                }
                // if (bre) break;
            }

            rep(i, H) rep(j, W) {
                if (s[i][j] == '#' && !seen[i][j]) can = false;
            }

            if (can) {
                cout << "YES\n";
                return 0;
            }
        }
    }
    cout << "NO\n";
    return 0;
}
0