結果

問題 No.179 塗り分け
ユーザー wing3196
提出日時 2015-04-05 23:44:31
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 865 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 77,652 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 13:17:03
合計ジャッジ時間 1,802 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 35 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
using namespace std;

int H,W;
char fld[50][50];

bool can(int y,int x){
	if(y==0 && x==0) return false;
	bool used[50][50] = {}, zero = true;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(fld[i][j]=='.' || used[i][j]) continue;
			if(i+y<0 || H<=i+y || j+x<0 || W<=j+x || fld[i+y][j+x]=='.') return false;
			zero = false; used[i+y][j+x] = true;
		}
	}
	if(zero) return false;
	return true;
}

int main(){
	cin>>H>>W;
	for(int i=0;i<H;i++)for(int j=0;j<W;j++) cin>>fld[i][j];
	bool ans = false;
	for(int i=0;i<H;i++)for(int j=0;j<W;j++) if(can(i,j)) ans = true;
	if(ans) puts("YES");
	else puts("NO");
	return 0;
}
0