402374: GYM100739 H Hard Molecules
Description
The mad scientist Dexter performs experiments in molecular chemistry. Today he will try to build a single molecule out of n atoms.
It is well-known that a molecule consists of individual atoms, some pairs of which are connected by atomic bonds. Each atom has its value of valence — the number of the bonds the atom can form with other atoms. An atom can form one or several bonds with another atom, but not with itself. The number of the bonds the atom has must be equal to its valency. A molecule must be connected, i.e. for each pair of atoms there must be a path of the bonds that connects the two atoms.
Dexter knows the valences of each of the n atoms. Help him find a molecule that can be built out of these atoms, or determine that it is impossible.
InputThe first line of input contains a single integer n (1 ≤ n ≤ 5000), the number of atoms. The second line contains n space-separated integers di (1 ≤ di ≤ 109), where di is equal to the valence of the i-th atom.
OutputIf it is possible to build a single connected molecule out of the given atoms, in the first line output "Yes". Then output n - 1 lines, where i-th line must contain n - i space-separated integer numbers. The j-th number in the i-th line must denote the number of the bonds between the atoms with numbers i and i + j. The atoms are numbered from 1 to n in the order as they appear in the input. If there are several solutions, output any of them.
If such molecule does not exist, output "No" in a single line (without quotes).
ExamplesInput2Output
200 200
YesInput
200
3Output
3 5 4
YesInput
2 1
3
3Output
1 1 1
No