結果

問題 No.179 塗り分け
ユーザー dnishdnish
提出日時 2017-05-03 06:26:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 1,713 ms
コンパイル使用メモリ 165,396 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 06:25:03
合計ジャッジ時間 3,791 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int)N;i++)
#define p(s) cout<<(s)<<endl
#define ck(n,a,b) ((a)<=(n)&&(n)<(b))
using namespace std;

int main(){
	int H,W;
	cin>>H>>W;
	string s[51];
	REP(i,0,H) cin>>s[i];
	string ans="NO";
	REP(dy,-H+1,H){
		REP(dx,-W+1,W){
			if(dy==0&&dx==0) continue;
			string tmps[51];
			REP(i,0,H) tmps[i]=s[i];
			bool flag=true;
			REP(i,0,H){
				REP(j,0,W){
					if(tmps[i][j]=='.') continue;
					int nx=j+dx;
					int ny=i+dy;
					if(!ck(ny,0,H)||!ck(nx,0,W)) {
						flag=false;
						break;
					}
					if(tmps[ny][nx]=='#'){//can move
						tmps[ny][nx]='.';//used
					}else{
						flag=false;
						break;
					}
				}
				if(!flag) break;
			}
			if(flag) {
				ans="YES";
			}
		}
	}
	p(ans);
	return 0;
}
0