結果

問題 No.179 塗り分け
ユーザー highdhighd
提出日時 2016-10-26 15:53:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,568 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 67,016 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 06:11:58
合計ジャッジ時間 2,398 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
int main() {
	enum class State{
		None,Red,Blue,Undefined
	};
	int height, width;
	std::cin >> height >> width;
	std::string l;
	std::getline(std::cin, l);
	State map[50][50];
	int cell_count = 0;
	for (int y = 0; y < height; y++) {
		std::string line;
		std::getline(std::cin, line);
		for (int x = 0; x < width; x++) {
			if (line[x] == '.') {
				map[x][y] = State::None;
			} else {
				cell_count++;
				map[x][y] = State::Undefined;
			}
		}
	}
	bool is_find=false;
	for (int y = 0; y < height; y++) {
		for (int x = 0; x < width; x++) {
			if (x != 0 || y != 0) {
				is_find=true;
				int blue_count = 0;
				State map_copy[50][50];
				for (int y1 = 0; y1 < height; y1++) {
					for (int x1 = 0; x1 < width; x1++) {
						map_copy[x1][y1] = map[x1][y1];
					}
				}
				for (int y_add = 0; y_add < height; y_add++) {
					for (int x_add = 0; x_add < width; x_add++) {
						if (map_copy[x_add][y_add] == State::None) {

						}else if (x_add - x < 0 || y_add - y < 0) {
							blue_count++;
							map_copy[x_add][y_add] = State::Blue;
							if (blue_count * 2 > cell_count) {
								is_find = false;
								break;
							}
						} else if (map_copy[x_add - x][y_add - y] == State::Blue) {
							map_copy[x_add][y_add] = State::Red;
						} else {
							blue_count++;
							map_copy[x_add][y_add] = State::Blue;
						}
					}
				}
			    loop2_end:
				if (is_find == true&& blue_count * 2 == cell_count) {
					goto loop1_end;
				}
			}
		}
	}
	loop1_end:
	std::cout << (is_find ? "YES" : "NO") << std::endl;
}
0