| ICPC-de-Tryst 2024 |
|---|
| Finished |
You are given $$$2$$$ arrays $$$A$$$ and $$$B$$$ of length $$$n$$$. You need to determine if there exists a permutation $$$P$$$ such that the following constraints are satisfied for all $$$1 \leq i \leq n$$$:
Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 2\times 10^5$$$), the number of test cases.
For each of the test case,
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 5\times 10^5$$$).
The second line contains $$$n$$$ space separated integers $$$A_1, A_2, \dots, A_n$$$ denoting the elements of $$$A$$$ ($$$1 \leq A_i \leq i)$$$.
The third line contains $$$n$$$ space separated integers $$$B_1,B_2,\dots, B_n$$$ denoting the elements of $$$B$$$ ($$$1 \leq B_i \leq n-i+1$$$).
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$5\times 10^5$$$.
For each of the test case, if there doesn't exist any permutation print $$$-1$$$. If there exists, print any valid permutation.
511131 1 21 2 131 2 31 1 151 1 2 3 23 3 2 1 151 2 2 2 22 2 1 2 1
1 3 1 2 -1 3 1 4 5 2 -1
For test case $$$4$$$,
Similarly
| Name |
|---|


