「DTOI-4」排列

Luogu
IDLGP8976
Time1000ms
Memory512MB
DifficultyP4
贪心2023洛谷原创Special Judge构造
小 L 给你一个**偶数** $n$ 和两个整数 $a, b$,请你构造一个长为 $n$ 的排列 $p$,使得其满足 $\displaystyle\sum_{i = 1}^{\frac{n}{2}} p_i \geq a$ 且 $\displaystyle\sum_{i = \frac{n}{2} + 1}^{n} p_i \geq b$。 ## Input **本题有多组测试数据。** 第一行,一个整数 $T$,表示数据组数。 对于每组数据: 一行,三个整数 $n, a, b$。 ## Output 对于每组数据,如果无解,输出 $-1$;否则,输出一行,$n$ 个整数,表示你构造出的排列 $p$。 **如有多解,输出任意一组均可。** [samples] ## Background **Update on 2023.2.1:新增一组针对 @[yuanjiabao](https://www.luogu.com.cn/user/455558) 的 Hack 数据,放置于 #21。** **Update on 2023.2.2:新增一组针对 @[CourtesyWei](https://www.luogu.com.cn/user/664070) 和 @[bizhidaojiaosha](https://www.luogu.com.cn/user/613616) 的 Hack 数据,放置于 #22。** ------------ ~~构造一个排列 $p$,使得~~$\small\color{white}{下标为奇数的项之和 \geq a 且下标为偶数的项之和 \geq b。}$ ## Note **本题开启 Special Judge。** | $\textbf{Subtask}$ | $n$ | $a, b$ | 分值 | | :------: | :------: | :------: | :------: | | $1$ | $2 \leq n \leq 10$ | 无特殊限制 | $20 \operatorname{pts}$ | | $2$ | 无特殊限制 | $a = b = 0$ | $10 \operatorname{pts}$ | | $3$ | 同上 | $a = 0$ 或 $b = 0$ | $10 \operatorname{pts}$ | | $4$ | 同上 | 无特殊限制 | $60 \operatorname{pts}$ | 对于 $100\%$ 的数据,$2 \leq n, \sum n \leq 10^5$,$0 \leq a, b \leq \frac{n(n + 1)}{2}$,$1 \leq T \leq 10$,$n$ 为**偶数**。
Samples
Input #1
2
6 6 12
6 8 14
Output #1
1 6 2 5 3 4
-1
API Response (JSON)
{
  "problem": {
    "name": "「DTOI-4」排列",
    "description": {
      "content": "小 L 给你一个**偶数** $n$ 和两个整数 $a, b$,请你构造一个长为 $n$ 的排列 $p$,使得其满足 $\\displaystyle\\sum_{i = 1}^{\\frac{n}{2}} p_i \\geq a$ 且 $\\displaystyle\\sum_{i = \\frac{n}{2} + 1}^{n} p_i \\geq b$。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P4"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP8976"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "小 L 给你一个**偶数** $n$ 和两个整数 $a, b$,请你构造一个长为 $n$ 的排列 $p$,使得其满足 $\\displaystyle\\sum_{i = 1}^{\\frac{n}{2}} p_i \\geq a$ 且 $\\displaystyle\\sum_{i = \\frac{n}{2} + 1}^{n} p_i \\geq b$。\n\n## Input\n\n**本题有多组测试数据。**\n\n第...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments