結果

問題 No.2682 Visible Divisible
ユーザー Theta
提出日時 2024-03-28 17:40:37
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 543 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 34,852 KB
最終ジャッジ日時 2024-09-30 14:47:30
合計ジャッジ時間 5,225 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd, lcm
import sys


def printe(*args, end="\n", **kwargs):
    print(*args, end=end, file=sys.stderr, **kwargs)


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    if K == 1:
        print("Yes")
        return
    A_filter = []
    for a_elm in A:
        if (gcd_ := gcd(a_elm, K)) == 1:
            continue
        A_filter.append(gcd_)
    printe(A_filter)
    if lcm(*A_filter) == K:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
0