結果

問題 No.1250 汝は倍数なりや?
ユーザー aaaaaaaaaa2230
提出日時 2021-05-12 21:44:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 600 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 82,784 KB
実行使用メモリ 82,632 KB
最終ジャッジ日時 2024-09-24 08:27:45
合計ジャッジ時間 4,151 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 TLE * 1 -- * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

n,h = map(int,input().split())
A = list(map(int,input().split()))
dic = {}
s = set()
now = h
for i in range(2,int(h**0.5)+1):
    if now%i:
        continue
    dic[i] = 0
    s.add(i)
    while now % i == 0:
        now //= i
        dic[i] += 1

if now != 1:
    dic[now] = 1
    s.add(now)

for a in A:
    now = a
    rem = []
    for c in s:
        if now%c:
            continue
        while now%c == 0:
            now //= c
            dic[c] -= 1
        if dic[c] <= 0:
            rem.append(c)
    for c in rem:
        s.remove(c)
if len(s) != 0:
    print("NO")
else:
    print("YES")
0