結果

問題 No.179 塗り分け
ユーザー CleyLCleyL
提出日時 2022-09-21 13:29:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,616 bytes
コンパイル時間 930 ms
コンパイル使用メモリ 94,864 KB
実行使用メモリ 155,952 KB
最終ジャッジ日時 2023-08-23 19:55:48
合計ジャッジ時間 12,537 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 12 ms
6,660 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 23 ms
29,420 KB
testcase_09 WA -
testcase_10 AC 1,662 ms
155,952 KB
testcase_11 AC 1,341 ms
132,196 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 315 ms
55,552 KB
testcase_19 AC 282 ms
52,092 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 WA -
testcase_23 AC 89 ms
37,960 KB
testcase_24 WA -
testcase_25 AC 27 ms
29,912 KB
testcase_26 WA -
testcase_27 AC 161 ms
42,056 KB
testcase_28 WA -
testcase_29 AC 369 ms
56,864 KB
testcase_30 WA -
testcase_31 AC 482 ms
68,412 KB
testcase_32 AC 623 ms
77,944 KB
testcase_33 AC 583 ms
74,956 KB
testcase_34 WA -
testcase_35 AC 740 ms
87,288 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 2 ms
4,376 KB
testcase_43 AC 5 ms
4,380 KB
testcase_44 AC 22 ms
9,016 KB
testcase_45 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
struct d{
  int a,b,c;
  bool operator<(d x){
    if(a == x.a){
      if(b == x.b){
        return c < x.c;
      }
      return b < x.b;
    }
    return a < x.a;
  }
  bool operator==(d x){
    return a==x.a && b==x.b && c==x.c;
  }
  bool operator>(d x){
    return !((*this) < x || (*this) == x);
  }
};
int main(){
  int h,w;cin>>h>>w;
  vector<vector<char>> A(h,vector<char>(w));
  int c = 0;
  for(int i = 0; h > i; i++){
    for(int j = 0; w > j; j++){
      cin>>A[i][j];
      if(A[i][j] == '#')c++;
    }
  }
  if(c%2 || c==0){
    cout << "NO" << endl;
    return 0;
  }
  int C = 0;
  set<pair<int,int>> X[h*w];
  vector<d> ZZ;
  for(int i = 0; h > i; i++){
    for(int j = 0; w > j; j++){
      for(int k = i; h > k; k++){
        for(int l = j; w > l; l++){
          //cout << (i-k)*w+(j-l)+h*w << endl;
          int tmp = (i-k)*w+(j-l)+h*w;
          ZZ.push_back({tmp,(i-k),(j-l)});
          if(i==k && j==l)continue;
          if(A[i][j] == '#' && A[k][l] == '#'){
            //cout << i-k << " " << j-l << endl;
            X[(i-k)*w+(j-l)+h*w].insert({i,j});
            X[(i-k)*w+(j-l)+h*w].insert({k,l});
          }
        }
      }
    }
  }
  //sort(ZZ.begin(),ZZ.end());
  //ZZ.erase(unique(ZZ.begin(),ZZ.end()),ZZ.end());
  //for(int i = 0; ZZ.size() > i; i++){
  //  cout << ZZ[i].a << " " << ZZ[i].b << " " << ZZ[i].c << endl;
  //}
  for(int i = 0; h*w > i; i++){
    if(X[i].size() == c){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}
0