| TheForces Round #12 (Double-Forces) |
|---|
| Закончено |
This is the hard version of the problem.The only difference is that there is the third restriction.
You're given two integers $$$n$$$ and $$$x$$$.Construct a permutation $$$p$$$ of length $$$2n$$$ which satisfies:
If no solution,output $$$-1$$$ instead.
The first line of input will contain a single integer $$$t(1 \leq t \leq 10^5)$$$, denoting the number of test cases.
Each test case consists a single line of input.
The only line of each test case contains two integers $$$n(2 \leq n \leq 10^5),x(1 \leq x \leq 2n)$$$. The sum of $$$n$$$ over all test cases won't exceed $$$10^5$$$.
For each test case, output on a new line — a permutaion of length $$$2n$$$ which satisfies the restrictions above.If no solution,output $$$-1$$$ instead.
3 2 3 3 5 4 6
3 2 4 1 5 2 3 4 1 6 -1
| Название |
|---|


