結果
| 問題 | No.1884 Sequence | 
| コンテスト | |
| ユーザー |  k_o_pasture | 
| 提出日時 | 2022-03-25 22:25:32 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 396 ms / 2,000 ms | 
| コード長 | 557 bytes | 
| コンパイル時間 | 118 ms | 
| コンパイル使用メモリ | 12,416 KB | 
| 実行使用メモリ | 34,288 KB | 
| 最終ジャッジ日時 | 2024-10-14 06:21:40 | 
| 合計ジャッジ時間 | 9,543 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 40 | 
ソースコード
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)
for d in D:
	if d == 0:
		if len(D) == len([d for d in D if d == 0]):
			print('Yes')
			exit()
		else:
			print('No')
			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')
            
            
            
        