結果
| 問題 | No.179 塗り分け |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-07 06:01:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,072 bytes |
| 記録 | |
| コンパイル時間 | 2,576 ms |
| コンパイル使用メモリ | 197,220 KB |
| 最終ジャッジ日時 | 2025-01-10 23:39:16 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 33 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()
const double PI = acos(-1);
int h, w;
vector<string> bd;
bool check() {
int c = 0;
REP (i, h) REP (j, w) c += bd[i][j] == '#';
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
int r = 0, b = 0;
vector<string> tmp = bd;
for (int i = 0; i+y < h; i++) {
for (int j = 0; j+x < w; j++) {
if (tmp[i][j] == '#') {
if (tmp[i+y][j+x] == '#' && x+y > 0) {
tmp[i][j] = 'r';
tmp[i+y][j+x] = 'b';
++r, ++b;
}
}
}
}
if (r == b && r + b == c) {
return true;
}
}
}
return false;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> h >> w;
REP (i, h) {
string s; cin >> s;
bd.push_back(s);
}
if (check())
cout << "YES" << endl;
else
cout << "NO" << endl;
return 0;
}