P15815 [CodeChef] KMXOR
提高-
题目描述

Read problems statements in Mandarin chinese, Russian and Vietnamese as well.

Chef is baking a large cake! The cake consists of $N$ different ingredients numbered $1$ through $N$. Chef can choose how much of each ingredient to use in his cake recipe; let's denote the amount of the $i$-th ingredient used in the cake by $g_{i}$. Chef can only measure ingredients in fixed whole units, so the amounts of all ingredients must be integers.

In order to keep the cake inexpensive (and, of course, use each ingredient from the recipe), the chosen amounts of ingredients have to satisfy the condition $1 ≤ g_{i} ≤ K$ (for each $1 ≤ i ≤ N$). The taste of the resulting cake is computed as the bitwise XOR of the amounts of all ingredients, i.e. $g_{1} \oplus g_{2} \oplus \dots \oplus g_{N}$. For example, if $N=3$ and $g = [1, 2, 5]$, the taste of the cake is equal to $1 \oplus 2 \oplus 5 = 6$.

Please help Chef and find one way to choose the amounts of all ingredients such that the taste of the cake is maximum possible.

------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains two space-separated integers $N$ and $K$.

------ Output ------
For each test case, print a single line containing $N$ space-separated integers $g_{1}, g_{2}, \dots, g_{N}$ — the amounts of ingredients $1, 2, \dots, N$.

------ Constraints ------
$1 ≤ T ≤ 40$
$1 ≤ N ≤ 10^{4}$
$1 ≤ K ≤ 10^{9}$

----- Sample Input 1 ------
2
3 5
4 3
----- Sample Output 1 ------
5 1 3
1 2 3 3
----- explanation 1 ------
Example case 1: The maximum possible taste of the cake is $5 \oplus 1 \oplus 3 = 7$.

Example case 2: The maximum possible taste is $1 \oplus 2 \oplus 3 \oplus 3 = 3$.

输入格式

见题面

输出格式

见题面

样例输入
2 3 5 4 3
样例输出
5 1 3 1 2 3 3