結果

問題 No.1250 汝は倍数なりや?
ユーザー shotoyooshotoyoo
提出日時 2020-10-09 22:02:57
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,496 bytes
コンパイル時間 1,226 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 102,068 KB
最終ジャッジ日時 2023-09-27 17:06:16
合計ジャッジ時間 10,312 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
71,648 KB
testcase_01 AC 82 ms
71,644 KB
testcase_02 AC 81 ms
71,708 KB
testcase_03 AC 82 ms
71,996 KB
testcase_04 AC 81 ms
72,080 KB
testcase_05 AC 81 ms
71,872 KB
testcase_06 RE -
testcase_07 AC 84 ms
71,908 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 83 ms
72,064 KB
testcase_12 AC 85 ms
72,064 KB
testcase_13 AC 85 ms
72,076 KB
testcase_14 RE -
testcase_15 AC 85 ms
71,960 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 87 ms
72,060 KB
testcase_19 AC 86 ms
71,944 KB
testcase_20 RE -
testcase_21 AC 85 ms
71,668 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 111 ms
79,012 KB
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 AC 113 ms
79,304 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 WA -
testcase_49 RE -
testcase_50 AC 81 ms
72,144 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:
    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(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