Problem Author: | Osman |
Prepared by: | Hasan Saleh (MathModel) |
Edited by: | Hasan Saleh (MathModel) |
Solution
Notice that are no restrictions on distinct elements of the array thus we can consider two elements and for the array such that \gcd(a,b)=x and \text{lcm}(a,b)=y , Notice that a \cdot b =\gcd(a,b) \cdot \text{lcm}(a,b) , which forces \text{lcm}(a,b) to be divisible by \gcd(a,b) thus a solution exist if \text{lcm}(a,b) \bmod \gcd(a,b)=0 which means a solution exist if y \bmod x=0.
The minimal solution holds for the array [\underbrace{x,x,x,...,x}_{n-1 \text{ times}},y] , since it's always guaranteed that x \le y.
The only edge case is when n=1 then x=y must hold.
Complexity .
for _ in range(int(input())):
n,x,y=map(int,input().split())
if(n==1):
if(x==y):
print(x)
else:
print(-1)
else:
if(y%x==0):
print(*([x]*(n-1)+[y]))
else:
print(-1)