結果

問題 No.2682 Visible Divisible
ユーザー 👑 H20H20
提出日時 2024-03-20 21:50:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 106,668 KB
最終ジャッジ日時 2024-03-20 21:50:56
合計ジャッジ時間 3,182 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
106,324 KB
testcase_01 AC 108 ms
106,236 KB
testcase_02 AC 107 ms
106,188 KB
testcase_03 AC 110 ms
106,268 KB
testcase_04 AC 108 ms
106,348 KB
testcase_05 AC 109 ms
106,340 KB
testcase_06 AC 109 ms
106,668 KB
testcase_07 AC 109 ms
105,960 KB
testcase_08 AC 42 ms
55,612 KB
testcase_09 AC 41 ms
55,612 KB
testcase_10 AC 41 ms
55,612 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 110 ms
105,864 KB
testcase_14 WA -
testcase_15 AC 109 ms
105,928 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

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())) 
if K>10**9:
    for a in A:
        if a%K==0:
            print('Yes')
            exit()
    print('No')
    exit()


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