#P4753. River Jumping
River Jumping
Description
There is a river of width . Little D is on the bank at coordinate . He wants to reach the bank at coordinate and then return to coordinate . Before reaching the bank at coordinate , Little D can only jump to positions with larger coordinates. After reaching the bank at coordinate , Little D can only jump to positions with smaller coordinates. There are rocks in the river. Little D hopes to land on each rock exactly once. Because Little D can jump very far, his jump length has a lower bound but no upper bound. Now determine whether he can achieve his goal.
Input Format
The first line contains three integers , representing the width of the river, the number of rocks, and the lower bound of the jump length.
The second line contains integers, representing the coordinates of the rocks: . It is guaranteed that is a strictly increasing sequence.
Output Format
If Little D can achieve his goal, output YES on the first line, and output numbers on the second line, in order, representing the indices of the stones that Little D lands on. In particular, the bank at coordinate has index , and the bank at coordinate has index . If there are multiple solutions, you may output any one of them.
If Little D cannot achieve his goal, output NO on the first line.
6 1 3
3
YES
1 2 0
6 2 2
2 4
YES
2 3 1 0
5 2 3
2 3
NO
Hint
For all testdata, it is guaranteed that , , and .
Translated by ChatGPT 5
京公网安备 11011102002149号