An array is said to be good if all its elements are distinct, i.e. no two elements of the array are equal to each other.
You are given a positive integer and an integer such that .
Construct an array of length that satisfies the following conditions
- has exactly good (contiguous) subarrays, and
- Every element of is an integer from to (both inclusive).
If there are multiple such arrays, you can print any of them.
Note: It can be shown that for all inputs satisfying the given constraints, there is always a valid solution.
Input Format
- The first line contains an integer , the number of testcases. The description of the testcases follow.
- Each testcase consists of a single line with two space separated integers, and respectively.
Output Format
- For each testcase print space separated integers, the elements of the constructed array.
- If there are multiple outputs, you can print any of them.
- Your output will be considered correct only if the following conditions are satisfied,
- Every element of the array is between and , and
- The array has exactly good subarrays
Constraints
- Sum of over all testcases is atmost .
Sample Input 1
3
5 5
5 15
5 7
Sample Output 1
1 1 1 1 1
1 2 3 4 5
1 2 2 1 1
Solution:
click here for solution
No comments:
Post a Comment