結果

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

ソースコード

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] = {};
	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;
			used[i+y][j+x] = true;
		}
	}
	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