結果
| 問題 | No.1884 Sequence | 
| コンテスト | |
| ユーザー |  H20 | 
| 提出日時 | 2022-03-25 21:44:43 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 276 ms / 2,000 ms | 
| コード長 | 525 bytes | 
| コンパイル時間 | 201 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 182,212 KB | 
| 最終ジャッジ日時 | 2024-10-14 05:41:01 | 
| 合計ジャッジ時間 | 7,675 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 40 | 
ソースコード
import collections
import math
N = int(input())
A = list(map(int, input().split())) 
CA = collections.Counter(A)
B = []
for a in A:
    if a!=0:
        B.append(a)
B.sort()
CB= collections.Counter(B)
if len(CB)==1 or len(CA)==1:
    print('Yes')
    exit()
temp = 0
for i in range(len(B)-1):
    if B[i+1]-B[i]==0:
        print('No')
        exit()
    temp = math.gcd(temp,B[i+1]-B[i])
v = B[0]
while CA[0]>=0 and v<B[-1]:
    if CA[v]==0:
        CA[0]-=1
    v+=temp
if CA[0]<0:
    print('No')
else:
    print('Yes')
            
            
            
        