結果
| 問題 | No.179 塗り分け |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-24 16:38:35 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 967 bytes |
| コンパイル時間 | 370 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2025-11-24 16:38:49 |
| 合計ジャッジ時間 | 13,915 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 WA * 1 |
| other | AC * 33 WA * 6 TLE * 1 |
ソースコード
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)
# 黒マスの任意のペアを使って dx,dy を決定
for i in range(len(black)):
x1, y1 = black[i]
for j in range(i + 1, len(black)):
x2, y2 = black[j]
dx = x2 - x1
dy = y2 - y1
A = []
B = []
check = True
# 各黒マスを 赤と青 に分類する
for (p, q) in black:
if (p + dx, q + dy) in black_base:
A.append((p, q))
elif (p - dx, q - dy) in black_base:
B.append((p, q))
else:
check = False
break
if check and len(A) > 0 and len(B) > 0:
print("YES")
exit()
print("NO")