結果

問題 No.179 塗り分け
コンテスト
ユーザー Ryushi-tech
提出日時 2020-06-24 19:49:49
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 567 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 316 ms
コンパイル使用メモリ 20,696 KB
実行使用メモリ 35,772 KB
最終ジャッジ日時 2026-03-23 02:11:59
合計ジャッジ時間 58,755 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 24 WA * 1 RE * 2 TLE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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