結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 WA -
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 2 ms
4,380 KB
testcase_24 WA -
testcase_25 AC 2 ms
4,384 KB
testcase_26 AC 9 ms
4,380 KB
testcase_27 WA -
testcase_28 AC 11 ms
4,376 KB
testcase_29 WA -
testcase_30 AC 7 ms
4,384 KB
testcase_31 WA -
testcase_32 AC 5 ms
4,376 KB
testcase_33 WA -
testcase_34 AC 12 ms
4,380 KB
testcase_35 WA -
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 WA -
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 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:50: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[i][j] = s.at(j)  == '#' ? 1 : 0;
			if(table[i][j]) ++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
				continue;
			}
			break;		
		}
		if(x == W && y == H)
		{
			cout << "YES";
			return 0;
		}

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