3123: The king game

时间限制:1000 ms 内存限制:128 MB
Special Judge 上传者:
提交:116 通过:33

题目描述

Coinciding with the National Day of Rainbow Island, the king invited $n$  ministers to play a game with prizes. First, he made the $n$ ministers line up, with the king at the head of the line. The king had some gold coins, and he wanted to give them to his ministers. However, the king was worried about the unfair distribution, so there were $k$ extra opportunities after the distribution -- each extra opportunity could be exchanged for any of the two ministers' gold coins. The king thought it fair that the number of gold coins in the minister's hands increased from $1$ to $n$. 

Can you help the king find the original gold coin sequence? To put it simply, construct a permutation of length $n$ such that the minimum number of swaps for the permutation to become ordered (from small to large) is $k$.

Note: A permutation is a sequence of numbers that contains consecutive numbers and is not repeated, e.g 4,3,2,1 or 4,5,3,1,2.


输入格式

Each test contains multiple test cases. The first line contains the number of test cases $T$ ($1 \leq T \leq 100$). Description of the test cases follows.

The first line of each test contains two numbers, $n$($2\leq n\leq 10^6$,$2\leq \sum n\leq 10^6)$ and $k$($1\leq k\leq n-1$), indicating the length of the permutation and the minimum number of swaps, respectively.


输出格式

For each test, output the permutation of length $n$ that you construct. If there are multiple answers, output any one.

输入样例 复制

2
6 2
6 3

输出样例 复制

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