結果

問題 No.1884 Sequence
ユーザー k_o_pasture
提出日時 2022-03-25 22:17:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 494 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 34,432 KB
最終ジャッジ日時 2024-10-14 06:11:17
合計ジャッジ時間 10,117 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 39 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import *

N = int(input())
A = sorted(list(map(int, input().split())))

c = 0 # 0 の数
B = []
for a in A:
	if a == 0:
		c += 1
	else:
		B.append(a)
# print('c',c)
# print('B',B)

D = [] # 差

for i in range(1,len(B)):
	D.append(B[i]-B[i-1])
# print('D',D)

if len(D) == len([d for d in D if d == 0]):
	print('Yes')
	exit()

G = gcd(*D) # 差の最大公約数
# print('G',G)
s = 0
for d in D:
	s += (d // G) - 1
# print('s',s)
if c >= s and s >= 0:
	print('Yes')
else:
	print('No')
0