結果

問題 No.179 塗り分け
ユーザー CsTarepanda
提出日時 2019-04-20 20:28:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 614 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-10-01 21:31:33
合計ジャッジ時間 36,267 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 33 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import copy
h, w = map(int, input().split())

field = [list(input()) for _ in range(h)]

def check(y, x):
    m = copy.deepcopy(field)
    for red_y in range(h):
        for red_x in range(w):
            if m[red_y][red_x] == "#":
                m[red_y][red_x] = "@"
                nx = red_x + x
                ny = red_y + y
                if ny >= h or nx >= w or m[ny][nx] != "#":
                    return False
                m[ny][nx] = "@"
    return True



for i in range(h):
    for j in range(w):
        if check(i, j):
            print("YES")
            exit()
print("NO")
0