結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2017-08-05 13:03:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,483 bytes |
コンパイル時間 | 1,548 ms |
コンパイル使用メモリ | 169,900 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-11 20:35:20 |
合計ジャッジ時間 | 3,217 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 35 WA * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; const string yes = "YES"; const string no = "NO"; const int MAX = 55; int h, w; char S[MAX][MAX]; bool vis[MAX][MAX]; inline bool in(const int hh, const int ww) { return 0 <= hh && hh < h && 0 <= ww && ww < w; } int main() { scanf("%d%d", &h, &w); { bool valid = false; for (int i = 0; i < h; i++) { scanf("%s", S[i]); for (int j = 0; j < w; j++) { valid |= S[i][j] == '#'; } } if (!valid) { cout << no << endl; return 0; } } for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (i == 0 && j == 0) { continue; } bool ok = true; memset(vis, false, sizeof(vis)); for (int k = 0; k < h; k++) { for (int l = 0; l < w; l++) { if (S[k][l] == '#' && !vis[k][l]) { if (!in(k + i, l + j) || S[k + i][l + j] == '.' || vis[k + i][l + j]) { ok = false; } else { vis[k + i][l + j] = true; } } } } if (ok) { //cerr << i << " " << j << endl; cout << yes << endl; return 0; } } } cout << no << endl; return 0; }