結果

問題 No.2682 Visible Divisible
ユーザー H20
提出日時 2024-03-20 22:02:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 606 bytes
コンパイル時間 599 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 119,216 KB
最終ジャッジ日時 2024-09-30 07:52:40
合計ジャッジ時間 5,383 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 4 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
import math
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N,K = map(int, input().split())
A = list(map(int, input().split())) 
v = 1
for a in A:
    gc = math.gcd(a,K)
    PC = collections.Counter(prime_factorize(gc))
    for k,v in PC.items():
        if K%(k**v)==0 and K%(k**(v+1))!=0:
            K//=(k**v)
if K==1:
    print('Yes')
else:
    print('No')
0