P8976 "DTOI-4" Permutation
Background
**Update on 2023.2.1: Added a set of hack testdata for @[yuanjiabao](https://www.luogu.com.cn/user/455558), placed at #21.**
**Update on 2023.2.2: Added a set of hack testdata for @[CourtesyWei](https://www.luogu.com.cn/user/664070) and @[bizhidaojiaosha](https://www.luogu.com.cn/user/613616), placed at #22.**
------------
~~Construct a permutation $p$ such that~~ $\small\color{white}{the sum of terms with odd indices \geq a and the sum of terms with even indices \geq b.}$
Description
Little L gives you an **even** integer $n$ and two integers $a, b$. Please construct a permutation $p$ of length $n$ such that it satisfies $\displaystyle\sum_{i = 1}^{\frac{n}{2}} p_i \geq a$ and $\displaystyle\sum_{i = \frac{n}{2} + 1}^{n} p_i \geq b$.
Input Format
**This problem has multiple test cases.**
The first line contains an integer $T$, which denotes the number of test cases.
For each test case:
One line contains three integers $n, a, b$.
Output Format
For each test case, if there is no solution, output $-1$. Otherwise, output one line with $n$ integers, representing the permutation $p$ you constructed.
**If there are multiple solutions, output any one of them.**
Explanation/Hint
**This problem uses Special Judge.**
| $\textbf{Subtask}$ | $n$ | $a, b$ | Score |
| :------: | :------: | :------: | :------: |
| $1$ | $2 \leq n \leq 10$ | No special restrictions | $20 \operatorname{pts}$ |
| $2$ | No special restrictions | $a = b = 0$ | $10 \operatorname{pts}$ |
| $3$ | Same as above | $a = 0$ or $b = 0$ | $10 \operatorname{pts}$ |
| $4$ | Same as above | No special restrictions | $60 \operatorname{pts}$ |
For $100\%$ of the testdata, $2 \leq n$, $\sum n \leq 10^5$, $0 \leq a, b \leq \frac{n(n + 1)}{2}$, $1 \leq T \leq 10$, and $n$ is **even**.
Translated by ChatGPT 5