結果

問題 No.179 塗り分け
ユーザー todo_2mariko
提出日時 2019-03-12 20:58:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 564 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-23 15:51:31
合計ジャッジ時間 36,891 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5 WA * 1
other AC * 24 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b = map(int, input().split(' '))
sq = [input().strip() for i in range(a)]
sq2 = [c for k in sq for c in k]
ans = 'NO'

if ('#' not in sq2) or sq2.count('#') % 2 == 1:
    print('NO')
    exit()
 
for h in range(a):
    for w in range(b):
        sq3 = list('0'*len(sq2)) 
        for t in range(len(sq2)):
            if sq2[t] == '#':
                if sq2[w+b*h] == '#' and 0 < w+b*h <= b:
                    sq3[t] = '1'
                    sq3[w+b*h] = '1'
        if sq2.count('#') == sq3.count('1'):
            ans = 'YES'
            break

print(ans)
0