結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
kakeyamay
|
| 提出日時 | 2023-01-02 16:17:28 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 909 bytes |
| コンパイル時間 | 1,186 ms |
| コンパイル使用メモリ | 116,256 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 00:57:25 |
| 合計ジャッジ時間 | 2,948 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 39 WA * 1 |
ソースコード
#include <algorithm>
#include <iostream>
#include <ranges>
#include <string>
#include <vector>
int main() {
int H, W;
std::cin >> H >> W;
std::vector<std::string> S(H);
for (auto& s : S) std::cin >> s;
for (auto dy : std::views::iota(1 - H, H)) {
for (auto dx : std::views::iota(1 - W, W)) {
if (dx == 0 && dy == 0) continue;
auto T = S;
for (auto y : std::views::iota(std::max(0, -dy), H - std::max(0, dy))) {
for (auto x : std::views::iota(std::max(0, -dx), W - std::max(0, dx))) {
if (T[y][x] != '#') continue;
if (T[y + dy][x + dx] != '#') goto inner_end;
T[y][x] = 'R';
T[y + dy][x + dx] = 'B';
}
}
if (std::ranges::any_of(T, [](const std::string& s) { return s.contains('#'); })) continue;
std::cout << "YES" << '\n';
return 0;
inner_end:;
}
}
std::cout << "NO" << '\n';
}
kakeyamay