A. 第1题-小美的合法数组

第1题-小美的合法数组

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目内容

小美有一个长度为 nn 的数组 aa ,他需要你判断这个数组是不是合法数组。

一个合法数组需要满足:

  • ai<ai+1,(0i<n1)a_i<a_{i+1}, (0\leq i<n-1)
  • bi=ai+1aib_i=a_{i+1}-a_ibi<bi+1,(0i<n2)b_i<b_{i+1}, (0\leq i<n-2)

输入描述

第一行,一个整数 n(1n105)n(1\leq n\leq 10^5) ,表示数组的长度。 第二行,nn 个整数表示数组 aa ,第 ii 个整数为 ai(1ai109)a_i(1\leq a_i\leq 10^9)

输出描述

如果是合法数组,输出 "Yes" ,否则输出 "No"

样例

输入

5
1 3 7 13 21

输出

Yes

秋招模拟赛第37场|2023.09.02-美团

Not Attended
Status
Done
Rule
IOI
Problem
5
Start at
2023-9-4 19:00
End at
2023-9-4 21:00
Duration
2 hour(s)
Host
Partic.
42