結果

問題 No.179 塗り分け
コンテスト
ユーザー nebukuro09
提出日時 2016-09-05 11:11:58
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
AC  
実行時間 210 ms / 3,000 ms
+ 304µs
コード長 612 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 58 ms
コンパイル使用メモリ 80,692 KB
実行使用メモリ 84,328 KB
最終ジャッジ日時 2026-07-18 07:58:03
合計ジャッジ時間 5,028 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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