結果

問題 No.1884 Sequence
ユーザー ytft
提出日時 2022-03-28 16:03:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 110,080 KB
最終ジャッジ日時 2024-11-07 07:39:11
合計ジャッジ時間 6,469 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,bisect
input=lambda:sys.stdin.readline().rstrip()
def gcd(a,b):
	m,M=min(a,b),max(a,b)
	return M if m==0 else gcd(m,M%m)
N=int(input())
A=sorted(list(map(int,input().split())))
ind=bisect.bisect_right(A,0)
d,flg=0,0
for i in range(ind,N-1):
	d=gcd(d,A[i+1]-A[i])
	flg|=A[i]==A[i-1]
if d==0:
	print('Yes')
elif flg:
	print('No')
else:
	print(['Yes','No'][(A[-1]-A[ind])//d+1-N>0])
0