結果

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

ソースコード

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] == '#' 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