結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 30 ms
10,752 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 29 ms
10,880 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 TLE -
testcase_11 WA -
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:
    print('NO')
    exit()

print(S)
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