結果

問題 No.2682 Visible Divisible
ユーザー H20
提出日時 2024-03-20 21:48:03
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 544 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 112,640 KB
最終ジャッジ日時 2024-09-30 07:35:43
合計ジャッジ時間 4,645 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 4 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
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())) 
C = collections.Counter(prime_factorize(K))
for k,v in C.items():
    for a in A:
        if a%(k**v)==0:
            break
    else:
        print('No')
        exit()
print('Yes')
0