結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2020-04-10 13:42:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,067 bytes |
コンパイル時間 | 1,778 ms |
コンパイル使用メモリ | 171,520 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-15 00:07:40 |
合計ジャッジ時間 | 3,474 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 39 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; template<typename T> void fin(T a){ cout<<a<<endl; exit(0); } signed main(){ int h,w;cin>>h>>w; vector<string> s(h),t(h); for(int i=0;i<h;i++)cin>>s[i]; for(int R=0;R<w;R++){ for(int D=0;D<h;D++){ if(!R&&!D)continue; bool ok=1; for(int i=0;i<h;i++)t[i]=s[i]; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ if(t[i][j]=='#'){ if(j+R>=w||i+D>=h)ok=0; else if(t[i+D][j+R]!='#')ok=0; else t[i+D][j+R]='.'; } } } if(ok)fin("YES"); } } for(int i=0;i<h;i++)reverse(s[i].begin(),s[i].end()); for(int R=0;R<w;R++){ for(int D=0;D<h;D++){ if(!R&&!D)continue; bool ok=1; for(int i=0;i<h;i++)t[i]=s[i]; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ if(t[i][j]=='#'){ if(j+R>=w||i+D>=h)ok=0; else if(t[i+D][j+R]!='#')ok=0; else t[i+D][j+R]='.'; } } } if(ok)fin("YES"); } } fin("NO"); }