結果

問題 No.1884 Sequence
ユーザー ikoma
提出日時 2022-03-25 23:08:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 82,228 KB
実行使用メモリ 180,608 KB
最終ジャッジ日時 2024-10-14 07:14:50
合計ジャッジ時間 6,807 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def solve():
    N=int(input())
    A=list(map(int,input().split()))
    if len(set(A)-set([0]))<=1:return True
    A.sort()
    cnt0=0
    d_lst = []
    for i in range(N-1):
        if A[i]==0:
            cnt0+=1
            continue
        d = A[i+1]-A[i]
        d_lst.append(d)
    d_min = min(d_lst)
    if d_min==0:
        return False
    for d in d_lst:
        if d%d_min!=0:return False
        cnt0 -= d//d_min-1
    return cnt0>=0

print("Yes" if solve() else "No")
0