結果

問題 No.179 塗り分け
ユーザー goto_isyuku
提出日時 2017-06-04 11:40:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 511 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-03 04:01:59
合計ジャッジ時間 2,483 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 6
other RE * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = [int() for x in input().split()]

point = []

for i in range(h):
  l = input().split()
  for j in range(w):
    if l[j] == "#":
      point.append([i, j])

dp = [[1 for x in range(w * 2 - 1)] for x in range(h)]

center = w - 1
dp[0][center] = 0

count = h * w - 1

for y in range(h):
  for x in range(w * 2 - 1):
    if dp[y][x] == 1:
      for p in point:
        if [p[0] + y, p[1] + x - w + 1] not in point:
          dp[y][x] = 0
          count -= 1

if count > 0:
  print("YES")
else:
  print("NO")
0