結果

問題 No.179 塗り分け
ユーザー omuomu
提出日時 2015-04-06 00:47:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,194 bytes
コンパイル時間 920 ms
コンパイル使用メモリ 87,652 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 11:36:13
合計ジャッジ時間 7,958 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 37 ms
6,940 KB
testcase_06 AC 11 ms
6,944 KB
testcase_07 WA -
testcase_08 AC 44 ms
6,940 KB
testcase_09 AC 45 ms
6,944 KB
testcase_10 AC 172 ms
6,944 KB
testcase_11 AC 147 ms
6,944 KB
testcase_12 AC 409 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 1 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 WA -
testcase_18 AC 153 ms
6,944 KB
testcase_19 AC 146 ms
6,944 KB
testcase_20 AC 292 ms
6,940 KB
testcase_21 AC 223 ms
6,940 KB
testcase_22 AC 232 ms
6,940 KB
testcase_23 AC 110 ms
6,944 KB
testcase_24 AC 193 ms
6,940 KB
testcase_25 AC 99 ms
6,940 KB
testcase_26 AC 128 ms
6,944 KB
testcase_27 AC 351 ms
6,940 KB
testcase_28 AC 286 ms
6,944 KB
testcase_29 AC 479 ms
6,944 KB
testcase_30 AC 174 ms
6,940 KB
testcase_31 AC 583 ms
6,944 KB
testcase_32 AC 190 ms
6,944 KB
testcase_33 AC 473 ms
6,944 KB
testcase_34 AC 248 ms
6,944 KB
testcase_35 AC 534 ms
6,940 KB
testcase_36 AC 1 ms
6,940 KB
testcase_37 AC 2 ms
6,944 KB
testcase_38 AC 2 ms
6,944 KB
testcase_39 AC 2 ms
6,944 KB
testcase_40 AC 2 ms
6,944 KB
testcase_41 AC 1 ms
6,940 KB
testcase_42 AC 1 ms
6,940 KB
testcase_43 AC 9 ms
6,944 KB
testcase_44 AC 53 ms
6,944 KB
testcase_45 AC 3 ms
6,940 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*2; k < h*2; k++){
		for (int l = -w*2; l < w*2; 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