AtCoder Grand Contest 059
D
Distinct Elements on Subsegments
AtCoder
⌀ 3319
原题
← CE →
翻译中…

Problem Statement

翻译中…

For an integer array $A=(A_1, A_2, \ldots, A_{N + K-1})$ ($1 \leq A_i \leq N+K-1$), let's construct an array $B=(B_1, B_2, \ldots, B_N)$, where $B_i$ is the number of distinct elements in $A_i,A_{i+1},\ldots,A_{i+K-1}$.

翻译中…

You are given $B_1, B_2, \ldots, B_N$. Determine if there exists an array $A$ which could have produced such an array $B$, and if yes, construct one.

翻译中…

Solve $T$ test cases for each input file.

翻译中…

Constraints

翻译中…
  • $1 \le T \le 5 \cdot 10^4$
  • $2 \le N \le 2 \cdot 10^5$
  • $2 \le K \le 2 \cdot 10^5$
  • $1 \le B_i \le K$
  • The sum of $N$ in one input file doesn't exceed $2\cdot 10^5$.
  • The sum of $K$ in one input file doesn't exceed $2\cdot 10^5$.
  • All values in the input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

T
case_1
case_2
\vdots
case_T

翻译中…

Each case is in the following format:

翻译中…

N K
B_1 B_2 \ldots B_N

翻译中…

Output

翻译中…

For each test case, if such an array $A$ doesn't exist, output NO.

翻译中…

Otherwise, output the answer in the following format:

翻译中…

YES
A_1 A_2 \ldots A_{N+K-1}

翻译中…

Here, $1 \leq A_i \leq N+K-1$ must hold, and $A$ should produce $B$. If multiple solutions exist, any of them will be accepted.

翻译中…

In printing YES or NO, you can output each letter in any case (upper or lower).

翻译中…

样例

Input #1
3
3 3
1 2 1
4 3
1 2 2 1
6 4
3 3 3 3 3 3
Output #1
NO
YES
1 1 1 2 2 2
YES
1 2 3 1 2 3 1 2 3
题目信息
题号
agc059_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。