问题 D: Haitang and Triangle

内存限制:256 MB 时间限制:1 S
题面:传统 评测方式:Special Judge 上传者:
提交:8 通过:3

题目描述

Given two integers $\textstyle n,m$, construct a permutation of length $\textstyle n$ that satisfies the following conditions.

-   There are exactly $\textstyle m$ subintervals of length $\textstyle 3$ such that the numbers in these subintervals form a (non-degenerate) triangle.

输入格式

Each test contains multiple test cases. The first line contains an integer $\textstyle T$ ($\textstyle 1\leq T\leq 10^5$) — the number of test cases. The description of the test cases follows.

The first and only line of each test case contains two integers $\textstyle n$ and $\textstyle m$ ($\textstyle 3\leq n\leq 3\times 10^5$, $\textstyle 0\leq m\leq n-2$) — the length of permutation and the target subintervals.

It is guaranteed that the sum of $\textstyle n$ over all test cases does not exceed $\textstyle 3\times 10^5$.

输出格式

For each test case, print one line.

If such a pair of permutations exists, print $\textstyle n$ integers $\textstyle p_i$, representing the permutation you have constructed. Otherwise, print “-1”.

输入样例 复制

5
4 0
4 1
4 2
6 2
11 5

输出样例 复制

3 1 2 4
1 2 3 4
-1
5 2 4 3 1 6
11 2 10 3 1 6 8 4 5 7 9

分类标签