結果

問題 No.179 塗り分け
ユーザー matsu7874matsu7874
提出日時 2015-10-21 17:08:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 761 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 18,080 KB
最終ジャッジ日時 2024-04-10 12:46:34
合計ジャッジ時間 12,361 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
17,952 KB
testcase_01 AC 32 ms
10,880 KB
testcase_02 AC 34 ms
10,880 KB
testcase_03 AC 31 ms
10,880 KB
testcase_04 AC 33 ms
10,880 KB
testcase_05 AC 31 ms
10,880 KB
testcase_06 AC 319 ms
11,008 KB
testcase_07 AC 32 ms
10,880 KB
testcase_08 AC 32 ms
11,008 KB
testcase_09 AC 145 ms
11,008 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
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 #

import copy
H, W = map(int, input().split())
S = []
for i in range(H):
    S.append([c for c in input()])

cnt_black = sum(S[i].count('#') for i in range(H))
if cnt_black % 2 == 1 or cnt_black == 0:
    print('NO')
    exit()

for h in range(-H + 1, H):
    for w in range(-W + 1, W):
        if h == 0 and w == 0:
            continue
        s = copy.deepcopy(S)
        cnt = 0
        for i in range(H):
            for j in range(W):
                if s[i][j] == '#':
                    if 0 <= i + h < H and 0 <= j + w < W and s[i + h][j + w] == '#':
                        s[i][j] = 'r'
                        s[i + h][j + w] = 'b'
                        cnt += 2
        if cnt == cnt_black:
            print('YES')
            exit()
print('NO')
0