結果

問題 No.179 塗り分け
ユーザー kaffelunkaffelun
提出日時 2017-09-30 23:00:23
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,035 bytes
コンパイル時間 1,127 ms
コンパイル使用メモリ 145,680 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-09 22:41:42
合計ジャッジ時間 2,893 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int S[50][50];
int f[50][50];
int main() {
	int H, W;
	cin >> H >> W;
	string s;
	bool flag = true;
	int sx, sy;
	for(int i = 0; i < H; i++) {
		cin >> s;
		for(int j = 0; j < s.length(); j++) {
			S[i][j] = s[j] == '.' ? 0 : 1;
			if(S[i][j] && flag) {
				sx = j, sy = i;
				flag = false;
			}
		}
	}
	if(flag) {
		cout << "NO" << endl;
		return 0;
	}
	for(int dy = 0; dy < H; dy++) {
		for(int dx = 0; dx < W; dx++) {
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					f[i][j] = S[i][j];
				}
			}
			if(dx == 0 && dy == 0) continue;
			flag = true;
			for(int py = 0; py < H; py++) {
				for(int px = 0; px < W; px++) {
					if(f[py][px]) {
						if(px + dx >= W || py + dy >= H || !f[py + dy][px + dx]) {
							flag = false;
							break;
						}
						f[py + dy][px + dx] = 0;
					}
				}
				if(!flag) break;
			}
			if(flag) {
				cout << dx << "," <<  dy << endl;
				break;
			}
		}
		if(flag) break;
	}
	cout << (flag ? "YES" : "NO") << endl;
	return 0;
}
0