結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
kakeyamay
|
| 提出日時 | 2019-07-03 22:25:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 747 bytes |
| コンパイル時間 | 2,184 ms |
| コンパイル使用メモリ | 198,204 KB |
| 最終ジャッジ日時 | 2025-01-07 05:53:16 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 35 WA * 5 |
ソースコード
#include <bits/stdc++.h>
int main() {
int H,W;
std::cin >> H >> W;
std::vector<std::string> S(H);
for(auto&v:S)std::cin >> v;
bool ans = false;
bool exist = false;
for(int y=-H+1;!ans&&y<H;++y){
for(int x=-W+1;!ans&&x<W;++x){
if(!x&&!y)continue;
bool result = true;
auto S2 = S;
for(int h=0;result&&h<H;++h){
for(int w=-W+1;result&&w<W;++w){
if(S2[h][w]!='#')continue;
exist = true;
S2[h][w]='R';
int h2=h+y,w2=w+x;
if(h2<0||H<=h2||w2<0||W<=w2){
result = false;
break;
}
if(S2[h2][w2]=='#'){
S2[h2][w2]='B';
continue;
}
result = false;
}
}
if(result)ans = true;
}
}
ans = ans && exist;
std::cout << (ans?"YES":"NO") << std::endl;
}
kakeyamay