結果
問題 |
No.179 塗り分け
|
ユーザー |
![]() |
提出日時 | 2023-11-06 01:51:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 62 ms / 3,000 ms |
コード長 | 982 bytes |
コンパイル時間 | 2,161 ms |
コンパイル使用メモリ | 196,540 KB |
最終ジャッジ日時 | 2025-02-17 19:47:00 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 40 |
ソースコード
#include"bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; #define rep(i,m,n) for(ll i=(ll)m;i<(ll)n;i++) #define Endl endl #define pr(i,j) make_pair(i,j) const ll mod = 998244353; const ll inf = 5e18; const ld pi = 3.14159265358979; int main() { ll h, w; cin >> h >> w; vector<string>m(h); rep(i, 0, h)cin >> m[i]; bool f = false; rep(i, 0, h) { rep(j, 0, w) { if (m[i][j] == '#')f = true; } } if (!f) { cout << "NO" << endl; return 0; } rep(i, -70, 70) { rep(j, -70, 70) { if (i == 0 && j == 0)continue; vector<string>copy = m; rep(k, 0, h) { rep(l, 0, w) { if (copy[k][l] == '#') { if (!(0 <= k + i && k + i < h))goto next; if (!(0 <= l + j && l + j < w))goto next; if (copy[k + i][l + j] == '#') { copy[k + i][l + j] = '.'; copy[k][l] = '.'; } else goto next; } } } cout << "YES" << endl; return 0; next:{} } } cout << "NO" << endl; }