結果

問題 No.179 塗り分け
ユーザー くれちーくれちー
提出日時 2017-01-11 22:10:37
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 811 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 22,272 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-14 06:16:04
合計ジャッジ時間 2,997 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 WA -
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 0 ms
6,948 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 10 ms
6,944 KB
testcase_09 RE -
testcase_10 AC 0 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 20 ms
6,944 KB
testcase_13 WA -
testcase_14 AC 1 ms
6,944 KB
testcase_15 AC 0 ms
6,940 KB
testcase_16 AC 0 ms
6,944 KB
testcase_17 AC 0 ms
6,940 KB
testcase_18 AC 1 ms
6,944 KB
testcase_19 AC 1 ms
6,944 KB
testcase_20 AC 20 ms
6,940 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 0 ms
6,940 KB
testcase_24 RE -
testcase_25 AC 0 ms
6,944 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 AC 7 ms
6,944 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 WA -
testcase_37 AC 0 ms
6,940 KB
testcase_38 AC 0 ms
6,944 KB
testcase_39 AC 0 ms
6,944 KB
testcase_40 AC 1 ms
6,940 KB
testcase_41 AC 1 ms
6,940 KB
testcase_42 AC 0 ms
6,940 KB
testcase_43 AC 1 ms
6,940 KB
testcase_44 AC 4 ms
6,944 KB
testcase_45 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d %d", &h, &w);
      |         ^~~~~~~~~~~~~~~~~~~~~~

ソースコード

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;
	rep(dy, h) rep(dx, w) {
		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[i + dy][j + dx] = false;
		}
		if (f2) {
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}
0