結果

問題 No.179 塗り分け
コンテスト
ユーザー roiti46
提出日時 2015-04-05 23:49:00
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 752 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 116 ms
コンパイル使用メモリ 77,620 KB
最終ジャッジ日時 2025-12-03 14:33:35
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 34 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

for dy in xrange(H):
    for dx in xrange(W):
        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):
            if not (0 <= y + dy < H): continue
            for x in xrange(W):
                if not (0 <= x + dx < W): continue
                if used[y][x]: continue
                if 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