結果

問題 No.179 塗り分け
ユーザー omuomu
提出日時 2015-04-06 00:43:45
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,186 bytes
コンパイル時間 697 ms
コンパイル使用メモリ 88,516 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 11:35:13
合計ジャッジ時間 3,742 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 13 ms
6,940 KB
testcase_06 AC 4 ms
6,944 KB
testcase_07 WA -
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 22 ms
6,944 KB
testcase_11 AC 17 ms
6,940 KB
testcase_12 AC 69 ms
6,940 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 WA -
testcase_18 AC 36 ms
6,940 KB
testcase_19 AC 34 ms
6,940 KB
testcase_20 AC 64 ms
6,944 KB
testcase_21 AC 55 ms
6,940 KB
testcase_22 AC 57 ms
6,940 KB
testcase_23 AC 24 ms
6,940 KB
testcase_24 AC 48 ms
6,940 KB
testcase_25 AC 25 ms
6,940 KB
testcase_26 AC 43 ms
6,944 KB
testcase_27 AC 146 ms
6,940 KB
testcase_28 AC 112 ms
6,940 KB
testcase_29 AC 200 ms
6,940 KB
testcase_30 AC 52 ms
6,940 KB
testcase_31 AC 249 ms
6,940 KB
testcase_32 AC 61 ms
6,940 KB
testcase_33 AC 189 ms
6,940 KB
testcase_34 AC 95 ms
6,940 KB
testcase_35 AC 217 ms
6,944 KB
testcase_36 AC 1 ms
6,940 KB
testcase_37 AC 1 ms
6,940 KB
testcase_38 AC 1 ms
6,944 KB
testcase_39 AC 1 ms
6,944 KB
testcase_40 AC 2 ms
6,940 KB
testcase_41 AC 2 ms
6,940 KB
testcase_42 AC 2 ms
6,940 KB
testcase_43 AC 4 ms
6,940 KB
testcase_44 AC 22 ms
6,940 KB
testcase_45 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
template<class T> inline T sqr(T x) { return x*x; }
typedef pair<int, int> P;
typedef long long ll;
typedef unsigned long long ull;

#define rep(i,n)  for(int (i) = 0;(i) < (n);(i)++)
#define clr(a) memset((a), 0 ,sizeof(a))
#define mclr(a) memset((a), -1 ,sizeof(a))
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (sizeof(a))
#define Fill(a,v) fill((int*)a,(int*)(a+(SZ(a)/SZ(*(a)))),v)
bool cheak(int x, int y, int xMax, int yMax){ return x >= 0 && y >= 0 && xMax > x && yMax > y; }
const int dx[4] = { -1, 0, 1, 0 }, dy[4] = { 0, 1, 0, -1 };
const int mod = 1000000007;
const int INF = 2147483647;


int main()
{
	int h,w;
	cin >> h >> w;
	string s[101];
	rep(i, h){
		cin >> s[i];
	}

	for (int k = -h; k < h; k++){
		for (int l = -w; l < w; l++){
			if (!(k == 0 && l == 0)){
				bool f[51][51]; clr(f);
				rep(i, h){
					rep(j, w){
						if (s[i][j] == '.')
							f[i][j] = true;
					}
				}

				for (int i = 0; i < h; i++){
					for (int j = 0; j < w; j++){


						if (s[i][j] == '#' && !f[i][j]){

							if (cheak(i + k, j + l, h, w)){
								if (s[i + k][j + l] == '#' && !f[i + k][j + l]){
									f[i][j] = true;
									f[i + k][j + l] = true;
									continue;
								}
							}

							if (cheak(i - k, j - l, h, w)){
								if (s[i - k][j - l] == '#' && !f[i - k][j - l]){
									f[i][j] = true;
									f[i - k][j - l] = true;
									continue;
								}
							}
						}
					}
				}

				rep(i, h){
					rep(j, w){
						if (f[i][j]){
							if (i == h - 1 && j == w - 1){
								cout << "YES" << endl;
								return 0;
							}
						}
						else
							goto LABEL;
					}
				}

			LABEL:;
			}
		}
	}



	
	cout << "NO" << endl;

	return 0;
}
0