結果

問題 No.179 塗り分け
ユーザー TawaraTawara
提出日時 2015-08-26 17:21:56
言語 Python2
(2.7.18)
結果
AC  
実行時間 888 ms / 3,000 ms
コード長 630 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 6,500 KB
実行使用メモリ 6,104 KB
最終ジャッジ日時 2023-09-30 20:43:48
合計ジャッジ時間 10,681 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,832 KB
testcase_01 AC 11 ms
5,864 KB
testcase_02 AC 11 ms
5,864 KB
testcase_03 AC 11 ms
5,972 KB
testcase_04 AC 11 ms
6,000 KB
testcase_05 AC 75 ms
5,864 KB
testcase_06 AC 11 ms
5,916 KB
testcase_07 AC 12 ms
6,000 KB
testcase_08 AC 620 ms
6,068 KB
testcase_09 AC 616 ms
5,976 KB
testcase_10 AC 12 ms
5,860 KB
testcase_11 AC 12 ms
6,064 KB
testcase_12 AC 566 ms
6,044 KB
testcase_13 AC 12 ms
6,024 KB
testcase_14 AC 12 ms
5,916 KB
testcase_15 AC 11 ms
5,968 KB
testcase_16 AC 11 ms
6,048 KB
testcase_17 AC 11 ms
5,852 KB
testcase_18 AC 25 ms
6,056 KB
testcase_19 AC 24 ms
5,872 KB
testcase_20 AC 588 ms
5,940 KB
testcase_21 AC 695 ms
6,064 KB
testcase_22 AC 888 ms
5,992 KB
testcase_23 AC 12 ms
5,856 KB
testcase_24 AC 636 ms
6,104 KB
testcase_25 AC 14 ms
5,952 KB
testcase_26 AC 96 ms
6,080 KB
testcase_27 AC 620 ms
5,992 KB
testcase_28 AC 35 ms
6,052 KB
testcase_29 AC 620 ms
6,000 KB
testcase_30 AC 257 ms
5,860 KB
testcase_31 AC 621 ms
5,880 KB
testcase_32 AC 174 ms
6,040 KB
testcase_33 AC 621 ms
5,860 KB
testcase_34 AC 124 ms
5,960 KB
testcase_35 AC 619 ms
6,024 KB
testcase_36 AC 11 ms
6,072 KB
testcase_37 AC 11 ms
5,900 KB
testcase_38 AC 11 ms
5,928 KB
testcase_39 AC 11 ms
5,896 KB
testcase_40 AC 11 ms
5,856 KB
testcase_41 AC 11 ms
5,868 KB
testcase_42 AC 11 ms
5,920 KB
testcase_43 AC 23 ms
5,912 KB
testcase_44 AC 83 ms
5,840 KB
testcase_45 AC 13 ms
5,844 KB
権限があれば一括ダウンロードができます

ソースコード

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/W][i%W] == "#") == 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