結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
めうめう🎒
|
| 提出日時 | 2017-02-01 16:58:21 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,217 bytes |
| コンパイル時間 | 871 ms |
| コンパイル使用メモリ | 74,848 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-03 03:32:13 |
| 合計ジャッジ時間 | 1,933 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 33 WA * 7 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;
#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)
#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair
int h, w, how = 0;
bool hyo[51][51] = {};
bool solve(int plusx, int plusy){
int now = 0;
bool used[51][51] = {};
for(int y = 0;y < h;y++){
for(int x = 0;x < w;x++){
if(hyo[x][y] && !used[x][y]){
int tox = x + plusx, toy = y + plusy;
if(tox >= w || toy >= h) return false;
if(!hyo[tox][toy]) return false;
used[x][y] = true;
used[tox][toy] = true;
now += 2;
}
}
}
if(now == how) return true;
return false;
}
int main() {
cin >> h >> w;
string str;
for(int i = 0;i < h;i++){
cin >> str;
for(int j = 0;j < w;j++){
if(str[j] == '#'){
hyo[j][i] = true;
how++;
}
}
}
bool ans = false;
for(int i = 0;i < w;i++){
for(int j = 0;j < h;j++){
if(solve(i, j)) ans = true;
}
}
if(ans) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
}
めうめう🎒