CF1942A.Farmer John's Challenge

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Farmer John's Challenge

Trade Winds - Patrick Deng

Let's call an array aa sorted if a1a2an1ana_1 \leq a_2 \leq \ldots \leq a_{n - 1} \leq a_{n}.

You are given two of Farmer John's favorite integers, nn and kk. He challenges you to find any array a1,a2,,ana_1, a_2, \ldots, a_{n} satisfying the following requirements:

  • 1ai1091 \leq a_i \leq 10^9 for each 1in1 \leq i \leq n;
  • Out of the nn total cyclic shifts of aa, exactly kk of them are sorted.^\dagger

If there is no such array aa, output 1-1.

^\daggerThe xx-th (1xn1 \leq x \leq n) cyclic shift of the array aa is ax,ax+1an,a1,a2ax1a_x, a_{x+1} \ldots a_n, a_1, a_2 \ldots a_{x - 1}. If cx,ic_{x, i} denotes the ii'th element of the xx'th cyclic shift of aa, exactly kk such xx should satisfy $c_{x,1} \leq c_{x,2} \leq \ldots \leq c_{x, n - 1} \leq c_{x, n}$.

For example, the cyclic shifts for a=[1,2,3,3]a = [1, 2, 3, 3] are the following:

  • x=1x = 1: [1,2,3,3][1, 2, 3, 3] (sorted);
  • x=2x = 2: [2,3,3,1][2, 3, 3, 1] (not sorted);
  • x=3x = 3: [3,3,1,2][3, 3, 1, 2] (not sorted);
  • x=4x = 4: [3,1,2,3][3, 1, 2, 3] (not sorted).

Input

The first line contains tt (1t1031 \leq t \leq 10^3) — the number of test cases.

Each test case contains two integers nn and kk (1kn1031 \leq k \leq n \leq 10^3) — the length of aa and the number of sorted cyclic shifts aa must have.

It is guaranteed that the sum of nn over all test cases does not exceed 10310^3.

Output

For each test case, print a single line:

  • if there is a valid array aa, output nn integers, representing a1,a2,,ana_1, a_2, \ldots, a_{n};
  • otherwise, output 1-1.

If there are multiple solutions, print any of them.

Note

In the first testcase, a=[1,1]a = [1, 1] satisfies n=2,k=2n = 2, k = 2:

The two cyclic shifts of aa are [a1,a2][a_1, a_2] and [a2,a1][a_2, a_1], which are both [1,1][1, 1] and are sorted.

In the second testcase, a=[69420,69,420]a = [69\,420, 69, 420] satisfies n=3,k=1n = 3, k = 1:

The three cyclic shifts of aa are [a1,a2,a3][a_1, a_2, a_3], [a2,a3,a1][a_2, a_3, a_1], [a3,a1,a2][a_3, a_1, a_2], which are [69420,69,420][69\,420, 69, 420], [69,420,69420][69, 420, 69\,420], and [420,69420,69][420, 69\,420, 69], respectively.

Only [69,420,69420][69, 420, 69\,420] is sorted.

Samples

3
2 2
3 1
3 2
1 1
69420 69 420
-1

在线编程 IDE

建议全屏模式获得最佳体验