結果

問題 No.179 塗り分け
ユーザー 古寺いろは古寺いろは
提出日時 2015-04-06 01:10:56
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 896 bytes
コンパイル時間 1,366 ms
コンパイル使用メモリ 166,936 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 11:40:55
合計ジャッジ時間 3,614 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

int main() {
	int H, W;
	string ans = "NO";
	cin >> H >> W;
	vector<string> board(H);
	for (int i = 0; i < H; i++)
	{
		cin >> board[i];
	}
	for (int i = -H; i <= H; i++)
	{
		for (int j = -W; j <= W; j++)
		{
			vector<vector<int>> check(H, vector<int>(W));
			bool flag = true;
			int count = 0;
			for (int k = 0; k < H; k++)
			{
				for (int l = 0; l < W; l++)
				{
					if (board[k][l] == '#' && !check[k][l]){
						count++;
						int nk = k + i;
						int nl = l + j;
						if (nk < 0 || nk >= H || nl < 0 || nl >= W){
							flag = false;
							break;
						}
						if (board[nk][nl] == '#' && !check[nk][nl]){
							check[k][l] = true;
							check[nk][nl] = true;
						}
						else{
							flag = false;
							break;
						}

					}
				}
			}
			if (count == 0) flag = false;
			if (flag) ans = "YES";
		}
	}
	cout << ans << endl;
}
0