結果

問題 No.179 塗り分け
ユーザー hotpepsihotpepsi
提出日時 2015-09-04 00:42:37
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 976 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 64,960 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 12:44:19
合計ジャッジ時間 1,789 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <sstream>
#include <vector>
#include <cstring>

using namespace std;

int main(int argc, char *argv[])
{
	string s;
	getline(cin, s);
	stringstream ss(s);
	int H, W;
	ss >> H >> W;
	int M[64][64] = {};
	int sum = 0;
	for (int i = 0; i < H; ++i) {
		getline(cin, s);
		for (int j = 0; j < (int)s.length(); ++j) {
			M[i][j] = s[j] != '.';
			sum += s[j] != '.';
		}
	}
	bool ans = false;
	int c = 1;
	for (int a = 0; !ans && (a < H); ++a) {
		for (int b = 0; b < W; ++b) {
			++c;
			if (a > 0 || b > 0) {
				int cnt = 0;
				bool f = true;
				for (int i = 0; f && (i + a < H); ++i) {
					for (int j = 0; j + b < W; ++j) {
						int x = M[i][j], y = M[i + a][j + b];
						if (x > 0 && x < c) {
							cnt += 2;
							M[i + a][j + b] = c;
							if (y <= 0) {
								f = false;
							}
						}
					}
				}
				if (f && cnt == sum) {
					ans = true;
				}
			}
		}
	}
	cout << (ans ? "YES" : "NO") << endl;
	return 0;
}
0