結果
| 問題 | No.179 塗り分け |
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-02-02 13:35:54 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 709 bytes |
| 記録 | |
| コンパイル時間 | 402 ms |
| コンパイル使用メモリ | 82,344 KB |
| 実行使用メモリ | 101,556 KB |
| 最終ジャッジ日時 | 2024-09-18 20:40:47 |
| 合計ジャッジ時間 | 14,838 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 WA * 1 |
| other | AC * 33 WA * 7 |
ソースコード
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):
if abs(gcd(a,b)) > 1:
return False
# 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('##','').find('#') != -1:
return False
return True
answer = 'YES' if any(test(a,b) for a in range(51) for b in range(-51,51)) else 'NO'
print(answer)
maspy