結果

問題 No.179 塗り分け
ユーザー Ryushi-tech
提出日時 2020-06-24 19:56:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 76,388 KB
最終ジャッジ日時 2024-07-02 08:49:05
合計ジャッジ時間 16,115 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 37 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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 or not D:
    print("NO")
    exit()

flg = False
m = max(D)
hw = h * w // 2 + 1
for i in range(1, min(m, hw)):
    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