結果

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

ソースコード

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[1:]:
	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