結果

問題 No.179 塗り分け
ユーザー maspy
提出日時 2020-02-02 13:32:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 657 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 110,592 KB
最終ジャッジ日時 2024-09-18 20:39:35
合計ジャッジ時間 19,418 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5 WA * 1
other AC * 33 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from math import gcd
import itertools

H,W = map(int,readline().split())
data = ''.join(read().decode().split())

def test(a,b):
    # ax + by = const 上をまとめる
    words = [[] for _ in range(5000)]
    for x,y in itertools.product(range(H), range(W)):
        key = a * x + b * y
        words[key].append(data[W*x+y])
    for w in words:
        if ''.join(w).replace('##','').count('#'):
            return False
    return True

answer = 'YES' if any(test(a,b) for a in range(50) for b in range(-50,50)) else 'NO'
print(answer)
0