結果

問題 No.179 塗り分け
ユーザー ttakanottakano
提出日時 2017-11-18 02:02:02
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 952 bytes
コンパイル時間 1,317 ms
コンパイル使用メモリ 149,028 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-16 19:17:02
合計ジャッジ時間 5,449 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 100000000000;

using namespace std;

int main() {
  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  string ans="NO";
  bool flag=true;
  REP(i,h){
    cin>>s[i];
  }
  for(int i=-h;i<h;i++){
    for(int j=-w;j<w;j++){
      if(i==0&&j==0)continue;
      auto c=s;
      flag=true;
      for(int k=0;k<h;k++){
        for(int l=0;l<w;l++){
          if(s[k][l]=='#'&&c[k][l]=='#'){
            int nk=i+k;
            int nl=j+l;
            if(nk<0||nk>h||nl>w||nl<0||s[k][l]!=s[nk][nl]){
              flag=false;
              goto stop;
            }
            c[k][l]=c[nk][nl]='.';
          }
        }
      }
      stop:
      ans=flag?"YES":"NO";
    }
  }
  print(ans);
}
0