結果

問題 No.1884 Sequence
ユーザー H20
提出日時 2022-03-25 21:43:26
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 511 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 182,260 KB
最終ジャッジ日時 2024-10-14 05:39:26
合計ジャッジ時間 7,856 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

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:
    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')
0