結果

問題 No.179 塗り分け
ユーザー t98slidert98slider
提出日時 2022-06-22 10:19:14
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,951 bytes
コンパイル時間 1,779 ms
コンパイル使用メモリ 173,132 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-05 16:41:02
合計ジャッジ時間 6,728 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

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

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> A(H);
    for(auto &&s:A)cin >> s;
    for(int my = 0; my <= H; my++){
        for(int mx = -W; mx < 0; mx++){
            bool flag = true;
            vector<vector<bool>> used(H, vector<bool>(W));
            for(int y = 0; y < H; y++){
                for(int x = W - 1; x >= 0; x--){
                    if(used[y][x])continue;
                    if(A[y][x] != '#')continue;
                    if(y + my >= H || x + mx >= W){
                        flag = false;
                        continue;
                    }
                    used[y][x] = true;
                    if(A[y + my][x + mx] == '#'){
                        used[y + my][x + mx] = true;
                    }else{
                        flag = false;
                    }
                }
            }
            if(flag){
                cout << "YES" << '\n';
                return 0;
            }
        }
    }
    for(int my = 0; my <= H; my++){
        for(int mx = 0; mx <= W; mx++){
            if(my == 0 && mx == 0)continue;
            bool flag = true;
            vector<vector<bool>> used(H, vector<bool>(W));
            for(int y = 0; y < H; y++){
                for(int x = 0; x < W; x++){
                    if(used[y][x])continue;
                    if(A[y][x] != '#')continue;
                    if(y + my >= H || x + mx >= W){
                        flag = false;
                        continue;
                    }
                    used[y][x] = true;
                    if(A[y + my][x + mx] == '#'){
                        used[y + my][x + mx] = true;
                    }else{
                        flag = false;
                    }
                }
            }
            if(flag){
                cout << "YES" << '\n';
                return 0;
            }
        }
    }
    cout << "NO" << '\n';
}
0