P28409 [洛谷] River Jumping
提高
题目描述

Problem Description

There is a river with a width of $N$. Xiao D is located at the riverbank with coordinate $0$ and wants to reach the riverbank with coordinate $N$ and then return to coordinate $0$. Before reaching the riverbank at coordinate $N$, Xiao D can only jump to positions with greater coordinates. After reaching the riverbank at coordinate $N$, Xiao D can only jump to positions with smaller coordinates. There are $M$ rocks in the middle of the river, and Xiao D hopes to jump onto each rock exactly once. Due to Xiao D's powerful jumping ability, there is a minimum jump length $S$, but no upper limit. Determine if he can achieve his goal.

Input Format

The first line contains three integers $N, M, S$, representing the width of the river, the number of rocks, and the minimum jump length, respectively.

The second line contains $M$ integers, representing the coordinates of the $M$ rocks $w_1, w_2, \cdots, w_N$. It is guaranteed that $\{w_i\}$ is an increasing sequence.

Output Format

If Xiao D can achieve his goal, the first line outputs YES, and the second line outputs $M+2$ numbers, representing the sequence of rock numbers Xiao D jumps onto. Specifically, the riverbank at coordinate $0$ is numbered as $0$, and the riverbank at coordinate $N$ is numbered as $M+1$. If there are multiple solutions, any one is acceptable.

If Xiao D cannot achieve his goal, the first line outputs NO.

Sample Input and Output

Sample Input #1

6 1 3
3

Sample Output #1

YES
1 2 0

Sample Input #2

6 2 2
2 4

Sample Output #2

YES
2 3 1 0

Sample Input #3

5 2 3
2 3

Sample Output #3

NO

Notes

For all data, it is guaranteed that $1 \le N, S \le 100000$, $0 \le M < N$, and $1 \le w_i < N$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6 1 3 3
样例输出
YES 1 2 0