結果
問題 | No.179 塗り分け |
ユーザー |
|
提出日時 | 2017-01-11 00:43:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,284 bytes |
コンパイル時間 | 600 ms |
コンパイル使用メモリ | 81,932 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-03 03:31:48 |
合計ジャッジ時間 | 2,434 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 34 WA * 6 |
ソースコード
#define _USE_MATH_DEFINES #include<stdio.h> #include<string> #include<iostream> #include<cctype> #include<cstdio> #include<vector> #include<stack> #include<queue> #include <algorithm> #include<math.h> #include<set> #include<map> #include<iomanip> //#include<bits/stdc++.h> using namespace std; int main() { int h, w; cin >> h >> w; bool n[550][550] = {}; string p; int r = 0; for (int i = 0; i < h; i++) { cin >> p; for (int j = 0; j < p.size(); j++) { if (p[j] == '#') { n[i][j] = 1; r++; } } // cout << i; } //cout << r << endl; if (r % 2) { cout << "NO" << endl; return 0; } bool R = 0; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (!i && !j)continue; bool f[550][550] = {}; bool p = 0; int y = 0;//cout << i; for (int I = 0; I < h; I++) { for (int J = 0; J < w; J++) { // cout << n[I][J]<< n[I+i][J+j]; if (n[I][J] && n[I + i][J + j]) { if (f[I][J]==0&&f[I + i][J + j] == 0) { y += 2; f[I][J] = 1; f[I+i][J+j] = 1; } //else if(!f[I][J]&&) p= 1; } if (p)break; } //cout << y << i << j << endl;; if (!p&&y == r) { cout << "YES" << endl; return 0; } } } } cout << "NO" << endl; return 0; }