

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
左右一列に 個のマスが並んでおり、左から 番目のマスの高さは です。
あなたは各マスについて 度ずつ次のいずれかの操作を行います。
- マスの高さを 低くする。
- 何もしない。
操作をうまく行うことでマスの高さを左から右に向かって単調非減少にできるか求めてください。
制約
- 入力は全て整数である。
入力
入力は以下の形式で標準入力から与えられる。
出力
マスの高さを左から右に向かって単調非減少にできるなら Yes
、そうでないなら No
を出力せよ。
入力例 1Copy
5 1 2 1 1 3
出力例 1Copy
Yes
左から 番目のマスのみ高さを 低くすることで目的を達成できます。
入力例 2Copy
4 1 3 2 1
出力例 2Copy
No
入力例 3Copy
5 1 2 3 4 5
出力例 3Copy
Yes
入力例 4Copy
1 1000000000
出力例 4Copy
Yes
Score : points
Problem Statement
There are squares arranged in a row from left to right. The height of the -th square from the left is .
For each square, you will perform either of the following operations once:
- Decrease the height of the square by .
- Do nothing.
Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right, print Yes
; otherwise, print No
.
Sample Input 1Copy
5 1 2 1 1 3
Sample Output 1Copy
Yes
You can achieve the objective by decreasing the height of only the second square from the left by .
Sample Input 2Copy
4 1 3 2 1
Sample Output 2Copy
No
Sample Input 3Copy
5 1 2 3 4 5
Sample Output 3Copy
Yes
Sample Input 4Copy
1 1000000000
Sample Output 4Copy
Yes