题目描述
Problem Description
$ N $ hurdles are placed on a number line. The position of the $ i $th hurdle is $ x_i $, where $ x_i $ is a positive integer and satisfies $x_1 < x_2 < \ldots < x_N$.
You are a hurdler. You start at the origin of the number line and run in the positive direction at a constant speed. You cannot change your running direction once you start. You can jump at any position (not necessarily at integer coordinates). When you jump, you move in the air for $ L $ meters and then land. However, jumping consumes stamina, so you cannot jump again for the next $ L $ meters after landing; you must run on the ground. Initially, you are on the ground.
Can you jump over all the hurdles without hitting any of them?
To jump over a hurdle at position $ x $, you must be in the air at position $ x $. Also, you are assumed to be on the ground at the position where you jump and land. In other words, you cannot jump at a position where there is a hurdle, nor can you land at a position where there is a hurdle. You can jump at the origin.
Input Format
The input is given from the standard input in the following format:
$ N $ $ L $ $ x_1 $ $ x_2 $ $ : $ $ x_N $
Output Format
If you can jump over all the hurdles without hitting any, output "YES"; otherwise, output "NO".
Sample Input and Output
Sample Input #1
3 4
3
5
13
Sample Output #1
YES
Sample Input #2
5 3
1
2
5
7
9
Sample Output #2
NO
Sample Input #3
5 6
1
2
3
4
5
Sample Output #3
YES
Sample Input #4
3 5
1
3
10
Sample Output #4
NO
Sample Input #5
4 4
2
3
9
15
Sample Output #5
NO
Sample Input #6
4 1
1
3
5
7
Sample Output #6
YES
Sample Input #7
4 6100991
199010
199110
6300101
9231211
Sample Output #7
NO
Notes/Hints
Constraints
- All input values are integers.
- $1 \leq N \leq 10^5$
- $1 \leq L \leq 10^9$
- $1 \leq x_1 < x_2 < \ldots < x_N \leq 10^9$
Partial Points
For $ 400 $ points, the following conditions are satisfied:
- $1 \leq N \leq 2000$
- $1 \leq L \leq 2000$
- $1 \leq x_1 < x_2 < \ldots < x_N \leq 2000$
Sample Explanation 1
Figure 1: An example of how to jump in Sample Input 1. The red lines represent the hurdles, and the blue lines show one way to jump over all the hurdles. In this example, you run on the ground for $0 \leq x \leq 1.2$. Then, you jump at $ x = 1.2 $, moving in the air for $ 1.2 < x < 5.2 $. Due to the jump, you must run on the ground for $5.2 \leq x \leq 9.2$. After that, you jump at $ x = 11 $, and you can jump over all the hurdles. This case satisfies the partial points constraints.
Sample Explanation 2
No matter how you jump, you cannot jump over the hurdle at position $ x = 5 $. This case satisfies the partial points constraints.
Sample Explanation 3
For example, if you jump at the origin, you can jump over all the hurdles. This case satisfies the partial points constraints.
Sample Explanation 4
You cannot move in the negative direction from the origin. This case satisfies the partial points constraints.
Sample Explanation 5
This case satisfies the partial points constraints.
Sample Explanation 6
This case satisfies the partial points constraints.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分