結果

問題 No.2682 Visible Divisible
ユーザー ThetaTheta
提出日時 2024-03-28 17:40:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 287 ms / 2,000 ms
コード長 543 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 37,208 KB
最終ジャッジ日時 2024-03-28 17:40:44
合計ジャッジ時間 6,375 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 243 ms
34,432 KB
testcase_01 AC 287 ms
34,744 KB
testcase_02 AC 262 ms
37,064 KB
testcase_03 AC 259 ms
37,208 KB
testcase_04 AC 226 ms
36,472 KB
testcase_05 AC 236 ms
34,392 KB
testcase_06 AC 221 ms
37,208 KB
testcase_07 AC 221 ms
35,880 KB
testcase_08 AC 29 ms
10,112 KB
testcase_09 AC 30 ms
10,112 KB
testcase_10 AC 30 ms
10,112 KB
testcase_11 AC 233 ms
36,604 KB
testcase_12 AC 234 ms
34,664 KB
testcase_13 AC 246 ms
36,176 KB
testcase_14 AC 263 ms
34,632 KB
testcase_15 AC 235 ms
36,020 KB
testcase_16 AC 220 ms
36,460 KB
権限があれば一括ダウンロードができます

ソースコード

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