結果

問題 No.179 塗り分け
ユーザー MIKI Takushi
提出日時 2019-01-03 17:31:34
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 26,624 KB
最終ジャッジ日時 2024-11-23 22:30:08
合計ジャッジ時間 95,904 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 16 WA * 1 TLE * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
from copy import deepcopy

h,w = map(int, input().split())
s = [list(input()) for _ in range(h)]

def check(dh,dw):
    s2 = deepcopy(s)
    for hi in range(h):
        for wi in range(w):
            if s2[hi][wi]=="#":
                if h>hi+dh>=0 and w>wi+dw>=0:
                    if s2[hi+dh][wi+dw]=="#":
                        s2[hi][wi] = "r"
                        s2[hi+dh][wi+dw] = "b"
                    else:
                        return False
                else:
                    return False
    return True

for dh in range(1-h,h):
    for dw in range(1-w,w):
        if dh==0 and dw==0:
            continue
        if check(dh,dw):
            print("YES")
            exit()
print("NO")
0