結果
| 問題 | No.179 塗り分け |
| コンテスト | |
| ユーザー |
h_noson
|
| 提出日時 | 2016-02-18 12:14:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,141 bytes |
| 記録 | |
| コンパイル時間 | 609 ms |
| コンパイル使用メモリ | 65,664 KB |
| 実行使用メモリ | 6,816 KB |
| 最終ジャッジ日時 | 2024-10-03 03:15:13 |
| 合計ジャッジ時間 | 2,817 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 39 WA * 1 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define RREP(i,s,e) for (int i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (int i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
bool search(vector<string>& s) {
int h = s.size();
int w = s[0].size();
bool found, ret = false;
rep (di,h) rep (dj,w) {
found = -1;
vector<string> b = s;
if (di == 0 && dj == 0)
continue;
rep (i,h) rep (j,w) {
if (b[i][j] == '#') {
if (i+di < h && j+dj < w && b[i+di][j+dj] == '#') {
b[i+di][j+dj] = '.';
found *= found;
}
else
found = 0;
}
}
ret |= found == 1;
}
return ret;
}
int main() {
int h, w;
cin >> h >> w;
vector<string> s;
s.resize(h);
rep (i,h) cin >> s[i];
bool ans = search(s);
rep (i,h) reverse(s[i].begin(),s[i].end());
ans |= search(s);
if (ans)
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}
h_noson