AtCoder Regular Contest 206 (Div. 2)
D
LIS ∩ LDS
AtCoder
⌀ 1930
原题
← CE →
翻译中…

Problem Statement

翻译中…

Among the elements of a permutation $P=(P_1,\ldots,P_N)$ of $(1,\ldots,N)$, those that satisfy the following condition are called good elements:

翻译中…
  • The element can be included in both a longest increasing subsequence and a longest decreasing subsequence of $P$.
翻译中…

You are given integers $N$ and $K$. Determine whether there exists a permutation $P$ of $(1,\ldots,N)$ such that there are exactly $K$ good elements, and if it exists, find one.

翻译中…

Answer for $T$ test cases.

翻译中…

Constraints

翻译中…
  • All input values are integers
  • $1 \leq T \leq 2\times 10^5$
  • $1 \leq N \leq 2\times 10^5$
  • $0\leq K \leq N$
  • The sum of $N$ over all test cases does not exceed $2\times 10^5$.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

T
\mathrm{case}_1
\vdots
\mathrm{case}_T

翻译中…

Each test case is given in the following format:

翻译中…

N K

翻译中…

Output

翻译中…

Output $T$ lines.

翻译中…

For the $i$-th line, if there does not exist a permutation satisfying the condition for the $i$-th test case, output -1. If it exists, output one of them in the following format:

翻译中…

P_1 \ldots P_N

翻译中…

If there are multiple solutions satisfying the condition, any of them will be accepted.

翻译中…

样例

Input #1
3
1 0
7 2
2 1
Output #1
-1
7 4 6 2 3 1 5
-1
In the $2$-nd test case, $P_4=2$ and $P_5=3$ are good elements. Indeed, $(2,3,5)$ is a longest increasing subsequence of $P$. Also, $(7,6,2,1)$ and $(7, 6, 3, 1)$ are longest decreasing subsequences of $P$. Therefore, in this sample output, $2$ and $3$ are good elements. The other elements are not good elements, so this output satisfies the condition. In the $1$-st and $3$-rd test cases, there does not exist a permutation satisfying the condition. Thus, output `-1`.
题目信息
题号
arc206_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。