

Time Limit: 2 sec / Memory Limit: 256 MB
配点 : 800 点
問題文
長さ N の数列 x が与えられます。 次の条件をすべて満たす数列 a が存在するか判定し、存在するならば a を 1 つ構成してください。
- a は長さ N^2 であり、整数 1, 2, ..., N をそれぞれちょうど N 個ずつ含む。
- 各 1 ≤ i ≤ N について、a に含まれる整数 i のうち左から i 番目に位置するものは、a 全体では左から x_i 番目に位置する。
制約
- 1 ≤ N ≤ 500
- 1 ≤ x_i ≤ N^2
- x_i はすべて相異なる。
入力
入力は以下の形式で標準入力から与えられる。
N x_1 x_2 ... x_N
出力
条件をすべて満たす数列 a が存在しないならば、No
を出力せよ。
存在するならば、1 行目に Yes
を出力し、2 行目に a を空白区切りで出力せよ。
入力例 1
3 1 5 9
出力例 1
Yes 1 1 1 2 2 2 3 3 3
たとえば、a に含まれる整数 2 のうち左から 2 番目に位置するものは、a 全体では左から 5 番目に位置しています。 整数 1, 3 についても同様に条件が成り立っています。
入力例 2
2 4 1
出力例 2
No
Score : 800 points
Problem Statement
You are given an integer sequence x of length N. Determine if there exists an integer sequence a that satisfies all of the following conditions, and if it exists, construct an instance of a.
- a is N^2 in length, containing N copies of each of the integers 1, 2, ..., N.
- For each 1 ≤ i ≤ N, the i-th occurrence of the integer i from the left in a is the x_i-th element of a from the left.
Constraints
- 1 ≤ N ≤ 500
- 1 ≤ x_i ≤ N^2
- All x_i are distinct.
Input
The input is given from Standard Input in the following format:
N x_1 x_2 ... x_N
Output
If there does not exist an integer sequence a that satisfies all the conditions, print No
.
If there does exist such an sequence a, print Yes
in the first line, then print an instance of a in the second line, with spaces inbetween.
Sample Input 1
3 1 5 9
Sample Output 1
Yes 1 1 1 2 2 2 3 3 3
For example, the second occurrence of the integer 2 from the left in a in the output is the fifth element of a from the left. Similarly, the condition is satisfied for the integers 1 and 3.
Sample Input 2
2 4 1
Sample Output 2
No