Array and Peaks

题意翻译

### 题目描述 对于一列 $n$ 个整数组成的数列,如果这个序列包括 $1$ 到 $n$ 的每个数字(即每个数字只出现一次),那么这个数列就叫做一个“排列”。 给您两个整数 $n$ 和 $k$,请您构造一个排列 $a$,要求这个排列符合上述要求并且要有 $k$ 个峰值。(如果在这个排列 $a$ 中的一个元素 $i$ 满足 $1 < i < n$ , $a_i > a_{i - 1}$ 且 $a_i > a_{i + 1}$,那么这个 $i$ 就叫峰值)。如果给定条件构造不出符合要求的排列,输出 $-1$。 ### 输入格式 第一行是一个整数 $t (1 \leq t \leq 100)$ 代表数据测试组数。 从第二行到第 $t + 1$ 行,每行包括两个数字 $n (1 \leq n \leq 100)$ 和 $k (0 \leq k \leq n)$。 ### 输出格式 输出 $t$ 行,对于每行,如果没有符合要求的排列,那么输出 $-1$,否则输出一行 $n$ 个数字——符合要求的排列。 如果有多组答案,随意输出一组。 ### 说明/提示 在样例的第二组测试数据中,我们可以构造一个排列 $a = [2, 4, 1, 5, 3]$。 $i = 2$ 和 $i = 4$ 是这个排列的峰值,因为 $a_2 > a_1, a_2 > a_3$ 并且 $a_4 > a_3, a_4 > a_5$。

题目描述

A sequence of $ n $ integers is called a permutation if it contains all integers from $ 1 $ to $ n $ exactly once. Given two integers $ n $ and $ k $ , construct a permutation $ a $ of numbers from $ 1 $ to $ n $ which has exactly $ k $ peaks. An index $ i $ of an array $ a $ of size $ n $ is said to be a peak if $ 1 < i < n $ and $ a_i \gt a_{i-1} $ and $ a_i \gt a_{i+1} $ . If such permutation is not possible, then print $ -1 $ .

输入输出格式

输入格式


The first line contains an integer $ t $ ( $ 1 \leq t \leq 100 $ ) — the number of test cases. Then $ t $ lines follow, each containing two space-separated integers $ n $ ( $ 1 \leq n \leq 100 $ ) and $ k $ ( $ 0 \leq k \leq n $ ) — the length of an array and the required number of peaks.

输出格式


Output $ t $ lines. For each test case, if there is no permutation with given length and number of peaks, then print $ -1 $ . Otherwise print a line containing $ n $ space-separated integers which forms a permutation of numbers from $ 1 $ to $ n $ and contains exactly $ k $ peaks. If there are multiple answers, print any.

输入输出样例

输入样例 #1

5
1 0
5 2
6 6
2 1
6 1

输出样例 #1

1 
2 4 1 5 3 
-1
-1
1 3 6 5 4 2

说明

In the second test case of the example, we have array $ a = [2,4,1,5,3] $ . Here, indices $ i=2 $ and $ i=4 $ are the peaks of the array. This is because $ (a_{2} \gt a_{1} $ , $ a_{2} \gt a_{3}) $ and $ (a_{4} \gt a_{3} $ , $ a_{4} \gt a_{5}) $ .