結果

問題 No.179 塗り分け
ユーザー TawaraTawara
提出日時 2015-08-26 17:19:47
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 630 bytes
コンパイル時間 546 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 12:44:11
合計ジャッジ時間 9,111 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,812 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 9 ms
6,944 KB
testcase_08 AC 566 ms
6,940 KB
testcase_09 AC 571 ms
6,944 KB
testcase_10 AC 10 ms
6,944 KB
testcase_11 AC 10 ms
6,940 KB
testcase_12 AC 511 ms
6,944 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 9 ms
6,940 KB
testcase_16 RE -
testcase_17 AC 9 ms
6,944 KB
testcase_18 AC 21 ms
6,940 KB
testcase_19 AC 20 ms
6,944 KB
testcase_20 AC 528 ms
6,940 KB
testcase_21 AC 641 ms
6,940 KB
testcase_22 AC 839 ms
6,940 KB
testcase_23 AC 10 ms
6,944 KB
testcase_24 AC 577 ms
6,944 KB
testcase_25 AC 12 ms
6,940 KB
testcase_26 AC 86 ms
6,944 KB
testcase_27 AC 563 ms
6,940 KB
testcase_28 AC 29 ms
6,944 KB
testcase_29 AC 605 ms
6,940 KB
testcase_30 AC 233 ms
6,940 KB
testcase_31 AC 578 ms
6,940 KB
testcase_32 AC 161 ms
6,940 KB
testcase_33 AC 566 ms
6,944 KB
testcase_34 AC 114 ms
6,944 KB
testcase_35 AC 566 ms
6,940 KB
testcase_36 RE -
testcase_37 AC 9 ms
6,944 KB
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(di,dj):
	flag = [[True for i in xrange(W)] for i in xrange(H)]
	for i in xrange(H):
		for j in xrange(W):
			if M[i][j] == "#" and flag[i][j]:
				ni = i + di
				nj = j + dj
				if 0 <= ni < H and 0 <= nj < W and M[ni][nj] == "#":
					flag[ni][nj] = False
				else:
					return False
	return True
H,W = map(int,raw_input().split(" "))
M = [list(raw_input()) for i in xrange(H)]
if sum(1 for i in xrange(H*W) if M[i/H][i%H] == "#") == 0:
	print "NO"
	quit()
for j in xrange(1,W):
	if check(0,j):
		print "YES"
		quit()
for i in xrange(1,H):
	for j in xrange(-W+1,W):
		if check(i,j):
			print "YES"
			quit()
print "NO"
0