K-Regular Array
시간 제한2초메모리 제한2048 MB
길이 k인 모든 부분 배열이 1부터 k까지를 모두 포함하도록 길이 n 배열을 만들고 원소 합을 최대로 한다.
문제
An array of size is considered -regular if every subarray of of size contains all integers from to , inclusive.
For example, is -regular, because its two subarrays of size are and , each of which contains all integers from to . On the other hand, is not -regular because the subarray of size does not contain .
Your task is to find a -regular array of size such that the sum of its elements is maximized.
입력
The first line of the input contains a single integer () --- the number of test cases. The description of the test cases follows.
Each test case consists of a single line containing two integers and () --- the desired size of the array , and the parameter described above.
It is guaranteed that the sum of across all test cases is at most .
출력
For each test case, output a single line containing integers --- a -regular array of size with maximal sum.
If there are multiple solutions, you may print any.
힌트
In the first sample case, the array is -regular because its two subarrays of size are and , each of which contains all integers from to . The sum of this array is , which we can show is maximal for this and .
In the second sample case, each subarray of size must contain , and therefore, the array must consist only of ones.