結果
問題 | No.179 塗り分け |
ユーザー |
|
提出日時 | 2022-06-22 10:24:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,161 bytes |
コンパイル時間 | 1,732 ms |
コンパイル使用メモリ | 174,156 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 13:52:56 |
合計ジャッジ時間 | 4,420 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 34 WA * 6 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int H, W; cin >> H >> W; vector<string> A(H); for(auto &&s:A)cin >> s; for(int my = 0; my <= H; my++){ for(int mx = -W; mx <= W; mx++){ if(my == 0 && mx == 0)continue; bool flag = true, dec = mx < 0; vector<vector<bool>> used(H, vector<bool>(W)); for(int y = 0; y < H; y++){ for(int x = (dec ? W - 1 : 0); (dec ? x >= 0 : x < W - 1); (dec ? x-- : x++)){ if(used[y][x])continue; if(A[y][x] != '#')continue; if(y + my >= H || x + mx >= W || x + mx < 0){ flag = false; continue; } used[y][x] = true; if(A[y + my][x + mx] == '#'){ used[y + my][x + mx] = true; }else{ flag = false; } } } if(flag){ cout << "YES" << '\n'; return 0; } } } cout << "NO" << '\n'; }