結果

問題 No.179 塗り分け
ユーザー MIKI TakushiMIKI Takushi
提出日時 2019-01-03 17:44:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 863 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-05-03 02:16:18
合計ジャッジ時間 12,949 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,880 KB
testcase_01 AC 32 ms
10,880 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 32 ms
10,880 KB
testcase_04 AC 32 ms
10,880 KB
testcase_05 AC 131 ms
10,880 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 RE -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 34 ms
11,136 KB
testcase_11 AC 33 ms
10,880 KB
testcase_12 AC 1,823 ms
11,008 KB
testcase_13 AC 32 ms
10,880 KB
testcase_14 AC 32 ms
10,752 KB
testcase_15 AC 31 ms
10,880 KB
testcase_16 WA -
testcase_17 RE -
testcase_18 AC 54 ms
11,008 KB
testcase_19 AC 52 ms
10,880 KB
testcase_20 AC 1,011 ms
10,752 KB
testcase_21 AC 218 ms
10,880 KB
testcase_22 AC 243 ms
11,008 KB
testcase_23 AC 33 ms
10,752 KB
testcase_24 AC 170 ms
10,880 KB
testcase_25 AC 38 ms
11,008 KB
testcase_26 AC 53 ms
10,880 KB
testcase_27 AC 676 ms
11,008 KB
testcase_28 AC 56 ms
10,880 KB
testcase_29 AC 1,009 ms
10,880 KB
testcase_30 AC 416 ms
10,752 KB
testcase_31 AC 1,224 ms
10,880 KB
testcase_32 AC 276 ms
10,880 KB
testcase_33 AC 1,245 ms
10,880 KB
testcase_34 AC 209 ms
10,880 KB
testcase_35 AC 1,433 ms
11,008 KB
testcase_36 AC 32 ms
10,752 KB
testcase_37 AC 32 ms
10,752 KB
testcase_38 AC 32 ms
10,624 KB
testcase_39 AC 32 ms
10,752 KB
testcase_40 AC 33 ms
10,624 KB
testcase_41 AC 31 ms
10,880 KB
testcase_42 AC 33 ms
10,752 KB
testcase_43 AC 54 ms
10,752 KB
testcase_44 AC 147 ms
10,752 KB
testcase_45 AC 36 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

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)
    cnt = 0
    for hi in range(h):
        for wi in range(w):
            if s2[hi][wi]=="#":
                cnt += 1
                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 cnt>1

black = []
for hi in range(h):
    for wi in range(w):
        if s[hi][wi]=="#":
            black.append((hi,wi))

hi,wi = black[0]
for i in range(1,len(black)):
    hi2,wi2 = black[i]
    if check(hi2-hi, wi2-wi):
        print("YES")
        exit()
print("NO")
0