結果

問題 No.1250 汝は倍数なりや?
コンテスト
ユーザー tanon710
提出日時 2020-10-10 00:28:04
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 76 ms / 1,000 ms
コード長 602 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 193 ms
コンパイル使用メモリ 84,840 KB
実行使用メモリ 172,928 KB
最終ジャッジ日時 2026-04-03 00:38:51
合計ジャッジ時間 3,317 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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