結果

問題 No.179 塗り分け
コンテスト
ユーザー T
提出日時 2025-11-24 14:25:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 564 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2025-11-24 14:25:05
合計ジャッジ時間 3,952 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 3
other AC * 18 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

H,W = map(int,input().split())
S = [input().strip() for i in range(H)]
black = []
for i in range(H):
	for j in range(W):
		if (S[i][j] == "#"):
			black.append((i,j))
		else:
			pass

if (len(black) < 2):
	print("NO")
	exit()

#黒座標を集合に変換
black_base = set(black)
#基準設定
base_x,base_y = black[0]

for (x,y) in black:
	dx = x - base_x
	dy = y - base_y
	
	check = True
	for (p,q) in black:
		dp = p + dx
		dq = q + dy
		
		if ((dp , dq) not in black_base):
			check = False
			break
		
	if (check == True):
		print("YES")
		exit()

print("NO")
0