結果

問題 No.179 塗り分け
ユーザー ssmkzkssmkzk
提出日時 2019-03-02 19:50:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,111 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 18,508 KB
最終ジャッジ日時 2023-09-05 16:57:37
合計ジャッジ時間 4,952 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,668 KB
testcase_01 AC 16 ms
8,100 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
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 itertools
import sys

H, W = map(int, input().split())

black_l = []
count = 0

for i in range(H):
    l = list(input())
    for j in range(W):
        if l[j] == "#":
            black_l.append(str(i) + "-" + str(j))
            count += 1

if count % 2 == 0:
    num = count // 2
else:
    print("NO")
    sys.exit()

pattern_l = list(itertools.combinations(black_l, num))

# print(black_l)
#print(pattern_l)

for l_i in pattern_l:
    ck_l = set(l_i)
    mom_l = set(black_l)
    trans_l = list(mom_l - ck_l)
    for i in range(1,20):
        for j in range(20):
            nowck_l = list(ck_l)
            nowtrans_l = set(trans_l)
            dis = nowtrans_l
            for li in nowck_l:
                r , l = map(int, li.split("-"))
                r += i
                l += j
                puls = str(r) + "-" + str(l)
                #print(puls)
                dis.add(puls)
            if len(dis) == num:
                # print(i,j)
                # print(nowck_l)
                # print(nowtrans_l)
                print("YES")
                sys.exit()

print("NO")
sys.exit()
0