結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-29 20:12:37 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,932 bytes |
| コンパイル時間 | 2,023 ms |
| コンパイル使用メモリ | 195,628 KB |
| 最終ジャッジ日時 | 2025-02-18 02:24:07 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 34 WA * 6 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
namespace {
using ModInt [[maybe_unused]] = atcoder::modint998244353;
using Num [[maybe_unused]] = long long int;
using Vec [[maybe_unused]] = std::vector<Num>;
using Set [[maybe_unused]] = std::set<Num>;
using Mset [[maybe_unused]] = std::multiset<Num>;
using Edges [[maybe_unused]] = std::vector<std::vector<Num>>;
template<typename T>
using Q [[maybe_unused]] = std::queue<T>;
template<typename T>
using PQ [[maybe_unused]] = std::priority_queue<T, std::vector<T>, std::greater<T>>;
}
using Grid = std::array<std::array<Num, 50>, 50>;
void solve(std::istream& is, std::ostream& os) {
Num h {0};
Num w {0};
is >> h >> w;
Grid base;
for(Num y{0}; y<h; ++y) {
std::string s;
is >> s;
for(Num x{0}; x<w; ++x) {
base[y][x] = s.at(x) == '#';
}
}
for(Num dy{0}; dy<h; ++dy) {
for(Num dx{0}; dx<w; ++dx) {
if ((dy == 0) && (dx == 0)) {
continue;
}
auto g = base;
bool failed {false};
for(Num y{0}; !failed && (y<h); ++y) {
const auto ty = dy + y;
for(Num x{0}; !failed && (x<w); ++x) {
const auto tx = dx + x;
if (g[y][x] == 0) {
continue;
}
if (g[y][x] == 1) {
if ((ty >= h) || (tx >= w) || (g[ty][tx] != 1)) {
failed = true;
break;
}
g[y][x] = 2;
g[ty][tx] = 3;
}
}
}
if (!failed) {
os << "YES\n";
return;
}
}
}
os << "NO\n";
return;
}
int main(void) {
solve(std::cin, std::cout);
return 0;
}