結果

問題 No.1884 Sequence
コンテスト
ユーザー n_na
提出日時 2022-03-25 23:51:30
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
RE  
実行時間 -
コード長 467 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,360 ms
コンパイル使用メモリ 84,864 KB
実行使用メモリ 118,016 KB
最終ジャッジ日時 2026-05-01 17:32:52
合計ジャッジ時間 6,484 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 6 RE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
A = list(map(int, input().split()))
num = A.count(0)

A.sort()
d = 10**16

for i in range(N-1):
    if A[i+1] == 0:
        continue
    tmp = A[i+1] - A[i]
    d = min(tmp,d)
A.reverse()

ans = "Yes"
for i in range(N-1):
    if A[i+1] == 0:
        continue
    if A[i+1] - A[i] == d:
        continue
    if (A[i] - A[i+1])%d != 0:
        ans = "No"
        break
    else:
        num -= (A[i] - A[i+1])//d - 1

print(ans if num >= 0 else "No")

0