結果

問題 No.1250 汝は倍数なりや?
ユーザー tanon710
提出日時 2020-10-10 00:27:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 602 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 82,216 KB
実行使用メモリ 101,392 KB
最終ジャッジ日時 2024-07-20 14:58:19
合計ジャッジ時間 5,176 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections

def ps(n):
    ret=collections.defaultdict(int)
    for i in range(2,int(n**0.5)+1):
        while n%i==0:
            ret[i]+=1
            n//=i
    if n!=1:
        ret[n]+=1
    return ret

n,h=map(int,input().split())
arr=list(map(int,input().split()))
primes=ps(h)
for val in arr:
    for p in primes.keys():
        if primes[p]==0:
            continue
        while val%p==0:
            primes[p]-=1
            val//=p
            if primes[p]==0:
                break
for p in primes.keys():
    if primes[p]!=0:
        print('No')
        break
else:
    print('Yes')
0