| CAMA 2024 |
|---|
| Finished |
Litusiano was solving a problem during the prestigious CAMA competition (the best competition in the world) when he came up with the following problem:
In CAMA, all participants deserve to be happy. You are given an integer $$$n$$$ and an array of integers $$$a$$$ of length $$$n$$$. The $$$i$$$-th participant will be happy if they are in one of the first $$$a_i$$$ positions in the final ranking. Your task is to find the lexicographically smallest ranking such that all $$$n$$$ participants are happy, i.e., each participant $$$i$$$ is placed within the first $$$a_i$$$ positions of the ranking.
Lexicographical order means that, given two arrays $$$x$$$ and $$$y$$$ of the same length, $$$x$$$ is smaller than $$$y$$$ if, at the first position $$$k$$$ where they differ, $$$x_k \lt y_k$$$. For example: - $$$[1, 2, 3]$$$ is smaller than $$$[1, 3, 2]$$$ because at the second position $$$2 \lt 3$$$. - $$$[2, 1, 3]$$$ is greater than $$$[1, 3, 2]$$$ because at the first position $$$2 \gt 1$$$.
In the spirit of CAMA, where everyone should leave the competition with a smile, your task is to ensure that all participants are happy. If it's not possible to construct such a ranking, return -1.
The input consists of multiple test cases. The first integer $$$t$$$ ($$$1 \leq t \leq 100$$$) denotes the number of test cases. The description of each test case is as follows:
- The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 69 \cdot 10^4$$$) — the number of participants. - The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \leq a_i \leq n$$$) — the values of the array $$$a$$$, where each value represents the maximum position in the ranking where the $$$i$$$-th participant will be happy.
The sum of $$$n$$$ won't exceed $$$69 \cdot 10^4$$$.
For each test case, print the lexicographically smallest ranking such that all participants are happy. If it is not possible, print -1.
353 5 4 1 432 1 243 4 2 2
4 1 3 5 2 -1 3 4 1 2
| Name |
|---|


