P14818 [CodeChef] GCDSUBARRAYS
普及
题目描述

You are given positive integers N and K.

You have to construct an array A of length N such that :
1 ≤ A_{i} ≤ 10^{18}
$\sum_{i=1}^{N} \sum_{j=i}^{N} F(i,j) = K$, where F(i,j) denotes the [gcd] of all elements of the subarray A[i, j].

If multiple such arrays exist, print any.
Report -1 if no such array exists.

Note that A[l, r] denotes the subarray $[A_{l} ,A_{l+1}, \ldots, A_{r-1}, A_{r}]$.

------ Input Format ------

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • Each test case consists of single line of input.
  • The only line of each test case contains two space-separated integers N and K — the number of elements and required sum.

------ Output Format ------

For each test case, output on a new line N space-separated integers, denoting array A.
Report -1 if no such array exists.

------ Constraints ------

$1 ≤ T ≤ 100$
$1 ≤ N ≤ 100$
$1 ≤ K ≤ 10^{18}$
- The sum of $N$ over all test cases won't exceed $1000$.

----- Sample Input 1 ------
3
1 5
2 4
3 1

----- Sample Output 1 ------
5
1 2
-1

----- explanation 1 ------
Test case $1$: The only possible array of size $1$ such that the sum of gcd of all subarrays is $5$ is $A = [5]$.

Test case $2$: Consider an array of size $2$ as $A = [1, 2]$. The subarrays of the array are:
- $[1]$: The gcd of this subarray is $1$.
- $[1, 2]$: The gcd of this subarray is $gcd(1, 2) = 1$.
- $[2]$: The gcd of this subarray is $2$.

The sum of gcd of all subarrays is $1+1+2= 4$.

Test case $3$: It can be proven that there exists no subarray of size $3$ such that the sum of gcd of all subarrays of the array is $1$.

输入格式

见题面

输出格式

见题面

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