結果

問題 No.179 塗り分け
ユーザー todo_2mariko
提出日時 2019-03-12 21:29:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-23 15:52:40
合計ジャッジ時間 3,538 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 3
other AC * 29 WA * 11
権限があれば一括ダウンロードができます

ソースコード

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):
        if not h == 0 and w == 0:
            sq3 = list('0'*len(sq2)) 
            for t in range(len(sq2)):
                if sq2[t] == '#' and t < t+w+(b*h) < a*b:
                    if sq2[t+w+(b*h)] == '#' and sq3[t]=='0':
                        sq3[t] = '1'
                        sq3[t+w+(b*h)] = '1'

            if sq2.count('#') == sq3.count('1'):
                ans = 'YES'
                break

print(ans)
0