Chef was on vacation when a thought struck him. Given three integers and he would like to make an array of length such that it satisfies the following conditions:
- for each
- The MEX of every contiguous subarray of length in is .
Please help Chef in finding such an array. If there are multiple answers, you can output any configuration; and if there is no possible answer, output .
Note: The MEX of an array is the minimum non-negative integer that is not present in it. For example,
- The MEX of array is because it contains and but not .
- The MEX of array is because is the smallest non-negative integer not present in the array.
- The MEX of array is .
Input Format
- The first line of input contains a single integer , denoting the number of test cases. The description of test cases follows.
- Each test case consists of a single line of input, containing three space-separated integers — the length of the required array, the length of subarrays to be checked, and the required MEX value respectively.
Output Format
For each test case, output a single line containing the answer:
- If no array satisfying the conditions exists, print .
- Otherwise, print space-separated integers denoting the elements of the array, the of which is .
If there are multiple answers, you can output any of them.
Constraints
- The sum of over all test cases does not exceed
Sample Input 1
3
3 3 3
4 3 2
5 4 5
Sample Output 1
0 1 2
1 0 1 1
-1
Explanation
Test Case : One possible answer is . The subarray of length has MEX . Other possible answers are , , , , .
Test Case : One possible answer is . There are two subarrays of length — and . Both of them have MEX , as required.
Test Case
Solution:
No comments:
Post a Comment