409813: GYM103785 H Perfect Array
Description
Abhinav is a scientist who works in the field of perfect arrays. What's a perfect array you ask, let me explain —
A perfect array of size $$$n$$$ is made by performing $$$n$$$ perfect operations on an empty array and –
- The $$$p$$$-th perfect operation involves choosing a random integer $$$q$$$ between $$$1$$$ and $$$p$$$ $$$(1\leq q \leq p)$$$, and inserting it in the $$$q$$$-th position. So, for instance if before the $$$p$$$-th operation array was like $$$A_{1},A_{2}...A_{q-1},A_{q},A_{q+1}....A_{p-1}$$$, then after the $$$p$$$-th operation array becomes $$$A_{1},A_{2}...A_{q-1},q,A_{q},A_{q+1},A_{q+2}....A_{p-1}$$$.
Harsh wants to become Abhinav's assistant and to check Harsh's intelligence, Abhinav gives him an array $$$Arr$$$ of size $$$n$$$ and asks him if it is a perfect array or not. And if $$$Arr$$$ is a perfect array, Harsh is required to give the sequence of $$$n$$$ operations that built up $$$Arr$$$.
Harsh is too dumb to solve this and asks for your help.
InputThe first line of input contains an integer $$$n$$$ $$$(1 \leq n \leq 200)$$$ – the size of given array.
The next line of input contains $$$n$$$ integers, $$$Arr_{1}, Arr_{2},....Arr_{n}$$$ $$$(1 \leq Arr_{i} \leq N)$$$ – the elements of given array.
OutputIf the given array is not perfect then print "NO".
Else, in the first line print "YES" and in the next line print the sequence of $$$n$$$ operations that built up the array.
ExamplesInput3 1 2 1Output
YES 1 1 2Input
2 2 2Output
NONote
In the first sample testcase,
- $$$1$$$-st operation – Add $$$1$$$ at $$$1$$$-st index. Array becomes $$$[1]$$$
- $$$2$$$-nd operation – Add $$$1$$$ at $$$1$$$-st index. Array becomes $$$[1,1]$$$
- $$$3$$$-rd operation – Add $$$2$$$ at $$$2$$$-nd index. Array becomes $$$[1,2,1]$$$
In the second sample testcase, there is no possible sequence of operations that can form the array $$$[2,2]$$$.