結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int h,w;
bool func(int y,int x,vector<string> s){
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(s[i][j] == '#'){
				if(i+y >= h || j+x >= w)return false;
				if(s[i+y][j+x] != '#')return false;
				s[i+y][j+x] = '.';
			}
		}
	}
	return true;
}

int main(void) {
	cin >> h >> w;
	vector<string> s(h);
	for(int i=0;i<h;i++){
		cin >> s[i];
	}

	bool f = false;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(i == 0 && j == 0)continue;
			f |= func(i,j,s);
		}
	}
	cout << (f?"YES":"NO") << endl;
	return 0;
}
0