結果

問題 No.179 塗り分け
ユーザー くれちーくれちー
提出日時 2017-01-11 22:20:24
言語 C90
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 841 bytes
コンパイル時間 751 ms
コンパイル使用メモリ 25,504 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-24 18:03:45
合計ジャッジ時間 14,770 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 39 ms
4,376 KB
testcase_06 AC 7 ms
4,380 KB
testcase_07 AC 0 ms
4,380 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 234 ms
4,380 KB
testcase_11 AC 190 ms
4,380 KB
testcase_12 AC 771 ms
4,380 KB
testcase_13 AC 0 ms
4,380 KB
testcase_14 AC 1 ms
4,384 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 483 ms
4,376 KB
testcase_19 AC 435 ms
4,380 KB
testcase_20 AC 853 ms
4,380 KB
testcase_21 AC 731 ms
4,380 KB
testcase_22 AC 244 ms
4,376 KB
testcase_23 AC 197 ms
4,376 KB
testcase_24 AC 297 ms
4,376 KB
testcase_25 AC 180 ms
4,380 KB
testcase_26 AC 542 ms
4,380 KB
testcase_27 AC 951 ms
4,376 KB
testcase_28 AC 493 ms
4,380 KB
testcase_29 AC 953 ms
4,376 KB
testcase_30 AC 668 ms
4,380 KB
testcase_31 AC 952 ms
4,384 KB
testcase_32 AC 604 ms
4,376 KB
testcase_33 AC 950 ms
4,376 KB
testcase_34 AC 561 ms
4,376 KB
testcase_35 AC 950 ms
4,384 KB
testcase_36 WA -
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 0 ms
4,376 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 1 ms
4,380 KB
testcase_43 AC 9 ms
4,376 KB
testcase_44 AC 56 ms
4,376 KB
testcase_45 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdbool.h>
#define rep(i, n) for (i = 0; i < n; i++)

int main() {
	int i, j, k, l;
	int h, w;
	scanf("%d %d", &h, &w);
	getchar();

	bool s[50][50], f[50][50], f2 = false;
	rep(i, h) {
		rep(j, w) {
			s[i][j] = f[i][j] = (getchar() == '#' ? true : false);
			if (!f2 && s[i][j]) f2 = true;
		}
		getchar();
	}
	if (!f2) {
		puts("NO");
		return 0;
	}

	int dy, dx;
	for (dy = -h + 1; dy < h; dy++) for (dx = -w + 1; dx < w; dx++) {
		if (dy == 0 && dx == 0) continue;
		f2 = true;
		rep(i, h) rep(j, w) {
			if (!f[i][j]) continue;
			int y = i + dy, x = j + dx;
			if (!(0 <= y && y < h && 0 <= x && x < w) || !f[y][x]) {
				rep(k, h) rep(l, w) f[k][l] = s[k][l];
				f2 = false;
				break;
			}
			else f[i][j] = f[y][x] = false;
		}
		if (f2) {
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}
0