結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
71,536 KB
testcase_01 AC 85 ms
71,372 KB
testcase_02 AC 88 ms
71,424 KB
testcase_03 AC 85 ms
71,676 KB
testcase_04 AC 86 ms
71,460 KB
testcase_05 AC 85 ms
71,408 KB
testcase_06 RE -
testcase_07 AC 81 ms
71,184 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 82 ms
71,464 KB
testcase_12 AC 80 ms
71,432 KB
testcase_13 AC 84 ms
71,256 KB
testcase_14 RE -
testcase_15 AC 91 ms
71,460 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 85 ms
71,532 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 82 ms
71,572 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 112 ms
78,656 KB
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 AC 118 ms
78,652 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 81 ms
71,652 KB
testcase_49 RE -
testcase_50 RE -
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
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 = factor(h)
    if all(d2[k]<=d[k] for k in d2.keys()):
        ans = "YES"
    else:
        ans = "NO"
print(ans)
0