結果

問題 No.1884 Sequence
ユーザー gew1fw
提出日時 2025-06-12 20:46:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 461 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 82,088 KB
実行使用メモリ 118,568 KB
最終ジャッジ日時 2025-06-12 20:47:08
合計ジャッジ時間 6,332 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())
a = list(map(int, input().split()))
s = [x for x in a if x != 0]

if not s:
    print("Yes")
else:
    k = len(s)
    if k == 1:
        print("Yes")
    else:
        s.sort()
        m = s[0]
        M = s[-1]
        g = 0
        for i in range(1, k):
            d = s[i] - s[i-1]
            g = math.gcd(g, d)
        max_B = m + (n-1) * g
        if M > max_B:
            print("No")
        else:
            print("Yes")
0