| CodeBrew : Freshers Contest 2022 |
|---|
| Закончено |
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 –
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.
The 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.
If 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.
3 1 2 1
YES 1 1 2
2 2 2
NO
In the first sample testcase,
In the second sample testcase, there is no possible sequence of operations that can form the array $$$[2,2]$$$.
| Название |
|---|


