結果
| 問題 | 
                            No.179 塗り分け
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-03-14 12:56:24 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 31 ms / 3,000 ms | 
| コード長 | 712 bytes | 
| コンパイル時間 | 812 ms | 
| コンパイル使用メモリ | 72,460 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-23 14:41:57 | 
| 合計ジャッジ時間 | 2,211 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 6 | 
| other | AC * 40 | 
ソースコード
#include<iostream>
#include<string>
#include<vector>
#include<array>
int main()
{
	int h{},w{};
	std::cin>>h>>w;
	std::vector<std::string> map(h);
	for(auto& v:map)std::cin>>v;
	
	for(int x_{}; x_<w; ++x_){
		for(int y_=-h; y_<h; ++y_){
			if(x_ or y_){
				std::vector<std::string> m(map);
				std::array<bool,2> f{};
				for(int x{}; x<w; ++x){
						for(int y{}; y<h; ++y){
							if(m[y][x]=='#'){
								f[0]=true;
								if(y_+y<0 or w<=x_+x or h<=y+y_ or m[y_+y][x_+x]=='.'){
									f[1]=true;break;
								}
								m[y][x]=m[y_+y][x_+x]='.';
							}
						}
						if(f[1])break;
				}
				if(f[0] and !f[1]){
					std::cout<<"YES";
					return EXIT_SUCCESS;
				}
			}
		}
	}
	std::cout<<"NO";
}