結果

問題 No.1884 Sequence
ユーザー aaaaaaaaaa2230
提出日時 2022-03-25 22:12:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 482 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 111,220 KB
最終ジャッジ日時 2024-10-14 06:05:16
合計ジャッジ時間 6,191 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
n = int(input())
A = sorted(list(map(int,input().split())))
zero = 0
nA = [0]
for i in range(n):
    if A[i] != 0:
        nA = A[i:]
        zero = i
        break

if len(nA) == 1:
    print("Yes")
    exit()

g = nA[1]-nA[0]
for a,na in zip(nA,nA[1:]):
    dif = na-a
    g = gcd(dif,g)

if g == 0:
    print("Yes" if len(set(nA)) == 1 else "No")
    exit()

for a,na in zip(nA,nA[1:]):
    dif = na-a
    zero -= dif//g-1
print("Yes" if zero >= 0 else "No")
0