結果

問題 No.179 塗り分け
ユーザー tomiyance
提出日時 2019-11-26 08:59:09
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 592 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-06 07:43:11
合計ジャッジ時間 3,268 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 4
other AC * 7 WA * 9 RE * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W = map(int,input().split())

S = []
for i in range(H):
  S.append(input())
def translation(px,py):
  C = [[0 for j in range(H)] for i in range(W)]
  for y in range(H):
    for x in range(W):
      if C[y][x] == 0:
        C[y][x] = 1
        if x + px < W and y + py < H:
          if S[y][x] != S[x + py][y + px]:
            return False
          C[x + py][y + px] = 1
        else:
          if S[y][x] != '.':
            return False
    return True
def check():
  for y in range(H):
    for x in range(W):
      if translation(y,x):
        return 'YES'
  return 'NO'
print(check())
0