結果

問題 No.179 塗り分け
ユーザー t-0gat-0ga
提出日時 2019-07-12 17:09:14
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,007 bytes
コンパイル時間 553 ms
コンパイル使用メモリ 68,504 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-11 06:12:05
合計ジャッジ時間 2,668 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 38 ms
4,380 KB
testcase_09 AC 35 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 18 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 WA -
testcase_17 AC 1 ms
4,384 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
4,376 KB
testcase_26 WA -
testcase_27 AC 26 ms
4,384 KB
testcase_28 WA -
testcase_29 AC 24 ms
4,380 KB
testcase_30 WA -
testcase_31 AC 23 ms
4,380 KB
testcase_32 WA -
testcase_33 AC 23 ms
4,384 KB
testcase_34 WA -
testcase_35 AC 22 ms
4,384 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 1 ms
4,380 KB
testcase_42 WA -
testcase_43 AC 2 ms
4,380 KB
testcase_44 AC 4 ms
4,380 KB
testcase_45 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:49:13: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(x == W && y == H)
      ~~~~~~~^~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>
#include <math.h> 
#include <string>
using namespace std;
int main()
{
	int H, W;
	cin >> H >> W;
	int table[51][51];
	int cnt = 0;
	for(int i = 0 ; i < H ; ++i)
	{
		string s;
		cin >> s;
		for(int j = 0 ; j < W ; ++j)
		{
			table[j][i] = s.at(j)  == '#' ? 1 : 0;
			if(table[j][i]) ++cnt;
		}
	}
	if((cnt%2) != 0 || cnt ==0) 
	{
		cout << "NO";
		return 0;
	}
	for(int i = -W ; i < W ; ++i)for(int j = -H ; j < H ; ++j)
	{
	    if(i==0 && j == 0) continue;
		int m[51][51];
		for(int k = 0 ; k < W ; ++k)for(int l = 0 ; l < H ; ++l)
		{
			m[k][l] = table[k][l];
		}
		int x, y;
		for(x = 0 ; x < W ; ++x)for(y = 0 ; y < H ; ++y)
		{
			if(m[x][y] != 1) continue;
			if(x+i < W && y+j < H && x+i >= 0 && y+j >= 0 && m[x+i][y+j] == 1)
			{
				m[x][y] = 2;//red
				m[x+i][y+j] = 3;//blue
			}
			break;		
		}
		if(x == W && y == H)
		{
			cout << "YES";
			return 0;
		}

	}
    cout << "NO";
    return 0;
}
0