結果

問題 No.179 塗り分け
ユーザー airuaiairuai
提出日時 2016-09-17 01:07:54
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,028 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 55,948 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 06:11:01
合計ジャッジ時間 1,892 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 WA -
testcase_08 AC 6 ms
6,940 KB
testcase_09 AC 6 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 5 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 WA -
testcase_17 AC 2 ms
6,944 KB
testcase_18 WA -
testcase_19 AC 3 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 WA -
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 6 ms
6,944 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 4 ms
6,940 KB
testcase_27 AC 12 ms
6,940 KB
testcase_28 AC 4 ms
6,944 KB
testcase_29 AC 14 ms
6,940 KB
testcase_30 AC 6 ms
6,944 KB
testcase_31 WA -
testcase_32 AC 7 ms
6,940 KB
testcase_33 WA -
testcase_34 AC 6 ms
6,940 KB
testcase_35 WA -
testcase_36 AC 1 ms
6,940 KB
testcase_37 AC 1 ms
6,940 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 2 ms
6,940 KB
testcase_41 AC 1 ms
6,940 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main() {
	int h, w;
	cin >> h;
	cin >> w;
	int sum = 0;
	char c;
	bool** dp = new bool*[h];

	for (int i = 0; i < h; ++i) {
		dp[i] = new bool[w];
		for (int j = 0; j < w; ++j) {
			cin >> c;
			if (c == '#') {
				++sum;
				dp[i][j] = true;
			}
			else{
				dp[i][j] = false;
			}
		}
	}
	if (sum % 2 == 1) {
		cout << "NO" << endl;
		return 0;
	}
	int count = 0;
	for (int i = 0; i < h; ++i) {
		for (int j = 1; j < w; ++j, count = 0) {
			for (int a = 0; a < h - i; ++a) {
				for (int b = 0; b < w - j; ++b) {
					if (dp[a + i][b + j] && dp[a][b]) {
						++count;
					}
				}
			}
			if (count == sum / 2) {
				cout << "YES" << endl;
				return 0;
			}
		}
		for (int j = -(w - 1); j < 0; ++j, count = 0) {
			for (int a = 0; a < h - i; ++a) {
				for (int b = 0; b < w + j; ++b) {
					if (dp[a + i][b] && dp[a][b - j]) {
						++count;
					}
				}
			}
			if (count == sum / 2) {
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}
0