結果

問題 No.1538 引きこもりさんは引き算が得意。
ユーザー gew1fw
提出日時 2025-06-12 20:38:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 332 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 81,908 KB
実行使用メモリ 54,116 KB
最終ジャッジ日時 2025-06-12 20:39:21
合計ジャッジ時間 4,430 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n, k = map(int, input().split())
a = list(map(int, input().split()))

if k in a:
    print("Yes")
    exit()

a_sorted = sorted(a)
d = 0
for i in range(1, n):
    diff = a_sorted[i] - a_sorted[i-1]
    d = math.gcd(d, diff)

if d == 0:
    print("Yes" if k == 0 else "No")
else:
    print("Yes" if k % d == 0 else "No")
0