結果

問題 No.179 塗り分け
ユーザー MIKI TakushiMIKI Takushi
提出日時 2019-01-03 17:31:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 17,824 KB
最終ジャッジ日時 2024-05-03 02:13:22
合計ジャッジ時間 6,137 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
17,824 KB
testcase_01 AC 34 ms
10,880 KB
testcase_02 AC 36 ms
10,752 KB
testcase_03 AC 36 ms
10,880 KB
testcase_04 AC 35 ms
10,880 KB
testcase_05 AC 822 ms
10,880 KB
testcase_06 AC 211 ms
11,008 KB
testcase_07 WA -
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます

ソースコード

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