結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-29 13:54:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 967 bytes |
| コンパイル時間 | 3,060 ms |
| コンパイル使用メモリ | 199,108 KB |
| 最終ジャッジ日時 | 2025-01-13 20:16:06 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 33 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char *argv[]) {
int h, w;
cin >> h >> w;
vector<string> grid(h);
for (int i = 0; i < h; ++i) {
cin >> grid[i];
}
bool ans = false;
for (int i = 0; i <= h && !ans; ++i) {
for (int j = 0; j < w && !ans; ++j) {
if (i + j == 0) {
continue;
}
bool ok = true;
vector<vector<bool>> used(h, vector(w, false));
for (int y = 0; y < h && ok; ++y) {
for (int x = 0; x < w && ok; ++x) {
char c = grid[y][x];
if (c != '#' || used[y][x]) {
continue;
}
int x2 = x + j, y2 = y + i;
if (x2 >= w || y2 >= h || grid[y2][x2] != '#' || used[y2][x2]) {
ok = false;
break;
}
used[y2][x2] = true;
used[y][x] = true;
}
}
if (ok) {
ans = true;
}
}
}
cout << (ans ? "YES" : "NO") << '\n';
}