結果

問題 No.179 塗り分け
ユーザー oxyshower
提出日時 2020-01-09 12:41:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,499 bytes
コンパイル時間 1,760 ms
コンパイル使用メモリ 174,364 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-23 03:49:20
合計ジャッジ時間 3,692 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 34 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}
// auto v = make_vec<int>(h, w);
// fill(v, 0);

signed main(){

  int h, w; cin >> h >> w;
  vector<string> s(h);
  for(int i = 0; i < h; i++){
    cin >> s[i];
  }

  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(i == 0 && j == 0) continue;
      auto v = make_vec<int>(h, w);
      fill(v, 0);
      auto visited = make_vec<int>(h, w);
      fill(visited, 0);
      bool judge = true;
      for(int k = 0; k < h; k++){
        for(int l = 0; l < w; l++){
          if(visited[k][l]) continue;
          if(s[k][l] == '#'){
            if(visited[k][l]) continue;
            if(k + i >= h || l + j >= w || s[k + i][l + j] == '.'){
              judge = false;
            }else{
              visited[k + i][l + j] = 1;
            }
          }
        }
      }
      if(judge){
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;

  return 0;
}
0