結果

問題 No.1250 汝は倍数なりや?
ユーザー shotoyooshotoyoo
提出日時 2020-10-09 22:05:22
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,526 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 101,508 KB
最終ジャッジ日時 2023-09-27 17:11:59
合計ジャッジ時間 8,596 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
72,032 KB
testcase_01 AC 85 ms
72,032 KB
testcase_02 AC 86 ms
72,108 KB
testcase_03 AC 84 ms
71,880 KB
testcase_04 AC 85 ms
71,980 KB
testcase_05 AC 88 ms
71,780 KB
testcase_06 AC 89 ms
72,132 KB
testcase_07 AC 86 ms
72,104 KB
testcase_08 AC 89 ms
71,976 KB
testcase_09 AC 89 ms
72,072 KB
testcase_10 AC 87 ms
71,736 KB
testcase_11 AC 86 ms
71,648 KB
testcase_12 AC 84 ms
71,924 KB
testcase_13 AC 86 ms
71,972 KB
testcase_14 AC 83 ms
71,880 KB
testcase_15 AC 86 ms
71,680 KB
testcase_16 AC 85 ms
71,996 KB
testcase_17 AC 85 ms
71,684 KB
testcase_18 AC 87 ms
71,624 KB
testcase_19 AC 84 ms
71,976 KB
testcase_20 AC 87 ms
72,016 KB
testcase_21 AC 84 ms
71,676 KB
testcase_22 AC 86 ms
71,676 KB
testcase_23 AC 124 ms
79,088 KB
testcase_24 AC 113 ms
79,336 KB
testcase_25 AC 118 ms
79,184 KB
testcase_26 AC 103 ms
77,992 KB
testcase_27 AC 120 ms
79,132 KB
testcase_28 AC 108 ms
79,080 KB
testcase_29 AC 101 ms
78,292 KB
testcase_30 AC 119 ms
79,076 KB
testcase_31 AC 102 ms
78,832 KB
testcase_32 AC 120 ms
79,108 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 AC 85 ms
71,444 KB
testcase_49 RE -
testcase_50 AC 84 ms
71,900 KB
testcase_51 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,h = list(map(int, input().split()))
a = list(map(int, input().split()))
def hurui(n):
    pl = []
    mpf = [None]*(n+1)
    for d in range(2,n):
        if mpf[d] is None:
            mpf[d] = d
            pl.append(d)
        for p in pl:
            if p*d>n or p>mpf[d]:
                break
            mpf[p*d] = p
    return pl, mpf
from collections import defaultdict
def factor2(n, m=None):
    # mを与えると、高々その素因数まで見て、残りは分解せずにそのまま出力する
    f = {}
    tmp = n
    M = int(-(-n**0.5//1))+1
    if m is not None:
        M = min(m+1, M)
    for i in range(2, M+1):
        if tmp<i:
            break
        if tmp%i==0:
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp //= i
            f[i] = cnt
    if tmp!=1:
        f[tmp] = 1
    if not f:
        f[n] = 1
    return f

if 0 in a or h==1:
    ans = "YES"
else:
    def factor(num):
        d = defaultdict(int)
        while num>1:
            d[mpf[num]] += 1
            num //= mpf[num]
        return d
    pl, mpf = hurui(max(abs(item) for item in a)+10)
    d = defaultdict(int)
    for num in a:
        dd = factor(abs(num))
        for k,v in dd.items():
            d[k] += v
    d2 = factor2(h)
    if all(d2[k]<=d[k] for k in d2.keys()):
        ans = "YES"
    else:
        ans = "NO"
print(ans)
0