結果

問題 No.179 塗り分け
ユーザー nebukuro09
提出日時 2016-09-05 10:17:08
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 538 bytes
コンパイル時間 763 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-03 03:27:29
合計ジャッジ時間 2,941 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 34 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

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)]
dxdy.pop(0)
xy = [(i, j) for i in xrange(H) for j in xrange(W)]

for dx, dy in dxdy:
    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:
        print 'YES'
        break
else:
    print 'NO'
0