結果

問題 No.179 塗り分け
コンテスト
ユーザー nebukuro09
提出日時 2016-09-05 11:11:58
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 358 ms / 3,000 ms
コード長 612 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 134 ms
コンパイル使用メモリ 77,368 KB
最終ジャッジ日時 2025-12-03 21:23:52
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

H, W = map(int, raw_input().split())
s = [raw_input() for i in xrange(H)]
dxdy = [(i, j) for i in xrange(H) for j in xrange(-W+1, W)]
xy = [(i, j) for i in xrange(H) for j in xrange(W)]

for dx, dy in dxdy:
    if dy <= 0 and dx == 0:
        continue
    taiou = set()
    for x, y in xy:
        if s[x][y] == '.':
            continue
        nx, ny = x+dx, y+dy
        if (x, y) in taiou:
            continue
        if nx >= H or ny >= W or s[nx][ny] == '.':
            break
        taiou.add((nx, ny))
    else:
        if len(taiou) > 0:
            print 'YES'
            break
else:
    print 'NO'
0