QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 512 MB Puntuación total: 100

#9641. Two permutations

Estadísticas

Little $D$ has a sequence $a_1, a_2, a_3, \dots, a_{2n}$ of length $2n$, where each number from $1$ to $n$ appears exactly twice. Furthermore, $a_1, a_2, a_3, \dots, a_n$ forms a permutation of $1 \sim n$.

Little $D$ denotes the two positions of the number $i$ as $x_i$ and $y_i$, satisfying $1 \le x_i \le n < y_i \le 2n$.

Little $D$ also defines a set operation $\oplus$ as follows:

$A \oplus B = \{x \mid [x \in A] + [x \in B] = 1\}$

Let $f(S)$ be the smallest positive integer that does not appear in $S$.

Now, Little $D$ will provide you with $v_i = f(\{a_{x_i}\} \oplus \{a_{x_i+1}\} \oplus \cdots \oplus \{a_{y_i}\})$. He wants you to construct a sequence $a$ that satisfies the conditions based on the sequence $v$.

Input

The first line contains a positive integer $T$, representing the number of test cases.

The next $2T$ lines describe $T$ test cases.

The first line of each test case contains a positive integer $n$, representing the number of distinct values in the sequence.

The second line of each test case contains $n$ positive integers $v_1, v_2, v_3, \dots, v_n$, representing the calculated values.

Output

For each test case, output the answer.

The first line of each test case should be the string Yes or No, indicating whether a solution exists.

If a solution exists, output $2n$ positive integers $a_1, a_2, a_3, \dots, a_{2n}$ on the second line, representing the sequence you constructed. If multiple valid constructions exist, any one of them is acceptable.

Examples

Input 1

2
4
1 2 2 2
3
3 2 1

Output 1

Yes
3 2 4 1 4 2 3 1
No

Constraints

Subtask $n \le$ $\sum n \le$ Special Property Score
$1$ $5$ $50$ $10$
$2$ $10$ $100$ $10$
$3$ $2 \times 10^5$ $2 \times 10^6$ $A$ $15$
$4$ $2 \times 10^5$ $2 \times 10^6$ $B$ $15$
$5$ $2 \times 10^5$ $2 \times 10^6$ $50$

Special Property $A$: $v_i \le 4$.

Special Property $B$: $v_{v_i} = v_i$.

For $100\%$ of the data, $1 \le T \le 10$, $1 \le n \le 2 \times 10^5$, $1 \le \sum n \le 2 \times 10^6$, $1 \le v_i \le n$.

The answer files provided do not contain the construction schemes.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.