#P1513A. Array and Peaks
Array and Peaks
No submission language available for this problem.
Description
A sequence of integers is called a permutation if it contains all integers from to exactly once.
Given two integers and , construct a permutation of numbers from to which has exactly peaks. An index of an array of size is said to be a peak if and and . If such permutation is not possible, then print .
The first line contains an integer () — the number of test cases.
Then lines follow, each containing two space-separated integers () and () — the length of an array and the required number of peaks.
Output lines. For each test case, if there is no permutation with given length and number of peaks, then print . Otherwise print a line containing space-separated integers which forms a permutation of numbers from to and contains exactly peaks.
If there are multiple answers, print any.
Input
The first line contains an integer () — the number of test cases.
Then lines follow, each containing two space-separated integers () and () — the length of an array and the required number of peaks.
Output
Output lines. For each test case, if there is no permutation with given length and number of peaks, then print . Otherwise print a line containing space-separated integers which forms a permutation of numbers from to and contains exactly peaks.
If there are multiple answers, print any.
Samples
Note
In the second test case of the example, we have array . Here, indices and are the peaks of the array. This is because , and , .