結果

問題 No.179 塗り分け
ユーザー yaoshimax
提出日時 2015-05-06 21:31:11
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 725 bytes
コンパイル時間 782 ms
コンパイル使用メモリ 76,556 KB
実行使用メモリ 79,836 KB
最終ジャッジ日時 2024-10-02 14:18:34
合計ジャッジ時間 13,800 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4 WA * 2
other AC * 38 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W=map(int,raw_input().split())
board=[raw_input() for i in range(H)]

for dx in range(-H+1,H,+1):
    for dy in range(-W+1,W,+1):
        if dx==0 and dy==0:
            continue
        used=[[False for i in range(W)]for j in range(H)]
        ok=True
        cnt=0
        for h in range(H):
            for w in range(W):
                if board[h][w]=='#' and used[h][w]==False:
                    if h+dx>=H or w+dy>=W:
                        ok=False
                    elif board[h+dx][w+dy]=='.':
                        ok=False
                    else:
                        cnt+=1
                        used[h+dx][w+dy]=True
        if ok and cnt>0:
            print"YES"
            exit()
print "NO"
0