結果

問題 No.179 塗り分け
ユーザー irumo8202irumo8202
提出日時 2022-01-30 09:45:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,358 ms / 3,000 ms
コード長 784 bytes
コンパイル時間 963 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 84,604 KB
最終ジャッジ日時 2023-09-02 01:30:24
合計ジャッジ時間 34,438 ms
ジャッジサーバーID
(参考情報)
judge11 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
71,604 KB
testcase_01 AC 86 ms
71,724 KB
testcase_02 AC 102 ms
77,472 KB
testcase_03 AC 87 ms
71,928 KB
testcase_04 AC 96 ms
76,460 KB
testcase_05 AC 235 ms
78,260 KB
testcase_06 AC 175 ms
78,400 KB
testcase_07 AC 1,107 ms
82,976 KB
testcase_08 AC 1,058 ms
82,112 KB
testcase_09 AC 1,068 ms
83,592 KB
testcase_10 AC 1,358 ms
83,264 KB
testcase_11 AC 1,170 ms
82,568 KB
testcase_12 AC 1,173 ms
82,536 KB
testcase_13 AC 103 ms
77,604 KB
testcase_14 AC 104 ms
77,648 KB
testcase_15 AC 86 ms
71,484 KB
testcase_16 AC 84 ms
71,696 KB
testcase_17 AC 83 ms
71,664 KB
testcase_18 AC 1,218 ms
83,812 KB
testcase_19 AC 1,196 ms
84,356 KB
testcase_20 AC 1,206 ms
84,604 KB
testcase_21 AC 1,132 ms
82,172 KB
testcase_22 AC 1,148 ms
84,000 KB
testcase_23 AC 1,163 ms
81,564 KB
testcase_24 AC 1,105 ms
81,772 KB
testcase_25 AC 1,107 ms
83,104 KB
testcase_26 AC 1,159 ms
82,252 KB
testcase_27 AC 1,230 ms
82,608 KB
testcase_28 AC 1,272 ms
82,112 KB
testcase_29 AC 1,286 ms
82,620 KB
testcase_30 AC 1,285 ms
84,392 KB
testcase_31 AC 1,305 ms
82,932 KB
testcase_32 AC 1,279 ms
84,544 KB
testcase_33 AC 1,283 ms
83,772 KB
testcase_34 AC 1,309 ms
84,300 KB
testcase_35 AC 1,306 ms
82,696 KB
testcase_36 AC 87 ms
71,660 KB
testcase_37 AC 88 ms
71,612 KB
testcase_38 AC 88 ms
71,880 KB
testcase_39 AC 88 ms
71,844 KB
testcase_40 AC 92 ms
76,384 KB
testcase_41 AC 87 ms
71,700 KB
testcase_42 AC 93 ms
76,428 KB
testcase_43 AC 136 ms
78,208 KB
testcase_44 AC 249 ms
78,468 KB
testcase_45 AC 114 ms
77,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy


def check(dy, dx):
    T = copy.deepcopy(S)
    paint = False
    for y in range(H):
        for x in range(W):
            if T[y][x]:
                if 0 <= y + dy < H and 0 <= x + dx < W and T[y + dy][x + dx]:
                    T[y + dy][x + dx] = 0
                    paint = True
                else:
                    return 0
    return paint


H, W = map(int, input().split())
S = [[1 if x == "#" else 0 for x in input()] for _ in range(H)]

ok = False
for dy in range(H):
    for dx in range(W):
        if dy == dx == 0:
            continue
        ok |= check(dy, dx)

S = [*map(lambda x: x[::-1], S)]

for dy in range(H):
    for dx in range(W):
        if dy == dx == 0:
            continue
        ok |= check(dy, dx)

print("YES" if ok else "NO")
0