結果
| 問題 |
No.179 塗り分け
|
| コンテスト | |
| ユーザー |
no15_renne
|
| 提出日時 | 2015-04-06 00:06:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,454 bytes |
| コンパイル時間 | 643 ms |
| コンパイル使用メモリ | 78,576 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-10-02 13:21:57 |
| 合計ジャッジ時間 | 1,959 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 33 WA * 7 |
ソースコード
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef vector<int> vi;
const int INF = 1e9;
const int MOD = 1e9+7;
int h, w;
bool check(int x, int y, vector<vi> g){
REP(i, h){
REP(j, w){
if(g[i][j]){
int dx = i + x, dy = j + y;
if(dx < 0 || dy < 0 || dx >= h || dy >= w) return false;
if(!g[dx][dy]) return false;
g[i][j] = g[dx][dy] = 0;
}
}
}
return true;
}
int main(void){
cin >> h >> w;
vector<vi> g(h, vi(w, 0));
REP(i, h){
REP(j, w){
char c; cin >> c;
if(c == '#') g[i][j] = 1;
}
}
REP(i, 50){
REP(j, 50){
if(!i && !j) continue;
if(check(i, j, g)){
cout << "YES" << endl;
return 0;
}
}
}
cout << "NO" << endl;
return 0;
}
no15_renne