結果
| 問題 |
No.179 塗り分け
|
| ユーザー |
|
| 提出日時 | 2017-01-11 00:33:46 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,277 bytes |
| コンパイル時間 | 740 ms |
| コンパイル使用メモリ | 81,872 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-03 03:31:33 |
| 合計ジャッジ時間 | 2,777 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 31 WA * 9 |
ソースコード
#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] = f[I ][J ];
}
else p= 1;
}
if (p)break;
}
//cout << y << i << j << endl;;
if (!p&&y == r) {
cout << "YES" << endl;
return 0;
}
}
}
}
cout << "NO" << endl;
return 0;
}