結果

問題 No.2682 Visible Divisible
ユーザー 👑 H20H20
提出日時 2024-03-20 22:02:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 606 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 114,164 KB
最終ジャッジ日時 2024-03-20 22:02:24
合計ジャッジ時間 6,168 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 246 ms
113,764 KB
testcase_01 AC 225 ms
113,548 KB
testcase_02 AC 225 ms
113,744 KB
testcase_03 AC 228 ms
114,164 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

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