結果

問題 No.179 塗り分け
ユーザー CsTarepandaCsTarepanda
提出日時 2019-04-21 17:18:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 772 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-15 23:07:19
合計ジャッジ時間 16,717 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

field = [list(input()) for _ in range(h)]
black_n = "".join(map("".join, field)).count("#")

if black_n > 0 and black_n % 2:
    print("NO")
    exit()

def check(y, x):
    if field[y][x] != "#":
        return False
    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