結果

問題 No.179 塗り分け
ユーザー roiti46
提出日時 2015-04-06 00:01:42
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-02 13:20:32
合計ジャッジ時間 6,109 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 32 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, raw_input().split())
S = [list(raw_input()) for i in xrange(H)]

for dy in xrange((H+1)/2+1):
    for dx in xrange((W+1)/2+1):
        if dx + dy == 0: continue

        flag = True
        used = [[S[y][x] == "." for x in xrange(W)] for y in xrange(H)] 

        for y in xrange(H):
            for x in xrange(W):
                if used[y][x]: continue
                if not (x+dx < W and y+dy < H) or used[y+dy][x+dx]:
                    flag = False
                    break
                used[y][x] = used[y+dy][x+dx] = True
            if not flag: break

        else:
            if sum(map(sum, used)) != H*W: continue
            print "YES"
            exit()

print "NO"
0