#K88132. Restore Strictly Increasing Sequence
Restore Strictly Increasing Sequence
Restore Strictly Increasing Sequence
You are given a sequence of n integers. Some positions in the sequence have a zero, which indicates a missing number. Your task is to replace the zeros with integers between 1 and k (inclusive) so that the entire sequence becomes strictly increasing.
If it is possible to complete the sequence, output "YES" followed by the restored sequence. If there is no way to restore the sequence under these conditions, output only "NO".
Note: The restored sequence must satisfy the condition \[ a_1 < a_2 < \cdots < a_n \] and each filled number must be between 1 and k (inclusive).
inputFormat
The first line contains two integers n and k separated by a space.
The second line contains n integers separated by spaces representing the sequence. A zero indicates a missing number that must be replaced.
outputFormat
If the sequence can be restored, output "YES" in the first line followed by a second line containing the restored strictly increasing sequence.
If it is impossible to restore the sequence, output "NO" in a single line.
## sample6 10
0 2 0 5 0 0
YES
1 2 3 5 6 7
</p>