結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2017-05-20 06:48:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 93 ms / 3,000 ms |
コード長 | 977 bytes |
コンパイル時間 | 1,355 ms |
コンパイル使用メモリ | 137,996 KB |
最終ジャッジ日時 | 2025-01-05 00:26:56 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 40 |
ソースコード
#include <cstdio> #include <cstring> #include <cmath> #include <cassert> #include <random> #include <vector> #include <algorithm> #include <array> #include <functional> #include <utility> #include <regex> #include <tuple> #include <map> #include <set> #include <iostream> using namespace std; int main(){ int h,w; -scanf("%d%d",&h,&w); vector<string> s(h); vector<array<int,2>> t; for(int y=0;y<h;y++){ cin>>s[y]; for(int x=0;x<w;x++){ if(s[y][x]=='#'){ t.push_back(array<int,2>({x,y})); } } } if(t.size()==0||t.size()&1){ puts("NO"); return 0; } for(int y=-50;y<50;y++){ for(int x=-50;x<50;x++){ if(y==0&&x==0)continue; auto u=t; while(u.size()){ auto f=*u.begin(); f[0]+=x; f[1]+=y; auto v=find(u.begin(),u.end(),f); if(v==u.end()){ break; } u.erase(v); u.erase(u.begin()); } if(u.size()==0){ puts("YES"); //cout<<x<<","<<y<<endl; return 0; } } } puts("NO"); return 0; }