結果

問題 No.179 塗り分け
ユーザー Ryushi-tech
提出日時 2020-06-24 19:49:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 567 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-07-01 22:52:30
合計ジャッジ時間 5,569 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 3 RE * 1 TLE * 1 -- * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())
S = []
for i in range(h):
    S.append(input())

cnt = 0
D = set()
for ss in S:
    for s in ss:
        cnt += 1
        if s == "#":
            D.add(cnt)

l = len(D)
if l & 1:
    print("NO")
    exit()

flg = False
m = max(D)
for i in range(1, m):
    cnt = 0
    tmp = []
    for d in D:
        if d in tmp:
            continue
        elif d + i in D:
            cnt += 1
            tmp.append(d + i)
    #print(i, cnt, tmp)
    if l // 2 == cnt:
        #print(i,cnt,tmp)
        flg = True
print("YES" if flg else "NO")

0