結果
問題 |
No.179 塗り分け
|
ユーザー |
|
提出日時 | 2016-09-05 11:11:58 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 1,866 ms / 3,000 ms |
コード長 | 612 bytes |
コンパイル時間 | 443 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 7,296 KB |
最終ジャッジ日時 | 2024-07-23 14:38:57 |
合計ジャッジ時間 | 6,718 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 40 |
ソースコード
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'