結果

問題 No.179 塗り分け
ユーザー maspymaspy
提出日時 2020-02-02 13:35:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 709 bytes
コンパイル時間 984 ms
コンパイル使用メモリ 81,608 KB
実行使用メモリ 100,308 KB
最終ジャッジ日時 2023-10-19 00:45:30
合計ジャッジ時間 17,563 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
67,844 KB
testcase_01 AC 240 ms
78,604 KB
testcase_02 WA -
testcase_03 AC 217 ms
79,252 KB
testcase_04 AC 65 ms
75,356 KB
testcase_05 AC 375 ms
83,500 KB
testcase_06 AC 44 ms
59,660 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 48 ms
61,892 KB
testcase_11 AC 47 ms
61,892 KB
testcase_12 AC 685 ms
97,180 KB
testcase_13 WA -
testcase_14 AC 217 ms
78,284 KB
testcase_15 AC 211 ms
78,824 KB
testcase_16 AC 44 ms
59,660 KB
testcase_17 WA -
testcase_18 AC 70 ms
75,336 KB
testcase_19 AC 70 ms
75,576 KB
testcase_20 AC 703 ms
97,076 KB
testcase_21 AC 776 ms
100,308 KB
testcase_22 AC 769 ms
99,700 KB
testcase_23 AC 49 ms
62,032 KB
testcase_24 AC 726 ms
99,360 KB
testcase_25 WA -
testcase_26 AC 335 ms
83,780 KB
testcase_27 AC 729 ms
99,648 KB
testcase_28 WA -
testcase_29 AC 733 ms
99,832 KB
testcase_30 AC 212 ms
80,180 KB
testcase_31 AC 726 ms
98,564 KB
testcase_32 AC 326 ms
84,156 KB
testcase_33 AC 714 ms
98,576 KB
testcase_34 AC 72 ms
75,404 KB
testcase_35 AC 722 ms
99,528 KB
testcase_36 AC 212 ms
78,944 KB
testcase_37 AC 223 ms
79,176 KB
testcase_38 AC 222 ms
78,040 KB
testcase_39 AC 217 ms
79,412 KB
testcase_40 AC 225 ms
79,388 KB
testcase_41 AC 352 ms
80,412 KB
testcase_42 AC 345 ms
80,492 KB
testcase_43 AC 273 ms
80,204 KB
testcase_44 AC 381 ms
84,428 KB
testcase_45 AC 245 ms
79,016 KB
権限があれば一括ダウンロードができます

ソースコード

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):
    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)
0