結果

問題 No.1884 Sequence
ユーザー n_na
提出日時 2022-03-25 23:51:30
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 467 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 108,736 KB
最終ジャッジ日時 2024-10-14 08:08:45
合計ジャッジ時間 6,204 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 6 RE * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

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