結果

問題 No.179 塗り分け
ユーザー e-mone-mon
提出日時 2015-04-06 01:25:52
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 3,000 ms
コード長 1,781 bytes
コンパイル時間 590 ms
コンパイル使用メモリ 88,292 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 20:38:21
合計ジャッジ時間 2,359 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

int main(){
    int H,W;
    cin >> H >> W;
    char M[H][W];
    int used[H][W];
    int count = 0;

    FOR(i,0,H){
        FOR(j,0,W){
            cin >> M[i][j];
            if(M[i][j] == '#') count++;
         }
    }
    if(count == 0){
        cout << "NO" << endl;
        return 0;
      }

    REP(i,H){
        FOR(j,-W,W){
            if(i == 0 and j == 0) continue;
            int count = 0;
            memset(used,0,H*W*sizeof(int));
            REP(k,H){
                int l;
                for(l=0;l<W;l++){
                    if(M[k][l] == '#' and used[k][l] == 0){
                        if(0 <= k + i and k+i< H and 0 <= l+j and l+j < W and  M[k+i][l+j] == '#' and used[k+i][l+j] == 0){
                            used[k][l] = 1;
                            used[k+i][l+j] = 1;
                        }else{
                            break;
                        }
                    }
                }
                if(l==W) count++;
            }
            if(count == H){
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;

    return 0;
}
0