CF1715B.Beautiful Array
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Stanley defines the beauty of an array a of length n , which contains non-negative integers, as follows: $$$$\sum\limits_{i = 1}^{n} \left \lfloor \frac{a_{i}}{k} \right \rfloor, $$ which means that we divide each element by k , round it down, and sum up the resulting values.
Stanley told Sam the integer k and asked him to find an array a of n non-negative integers, such that the beauty is equal to b and the sum of elements is equal to s$$. Help Sam — find any of the arrays satisfying the conditions above.
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t ( 1≤t≤1000 ). Description of the test cases follows.
The first line of each test case contains integers n , k , b , s ( 1≤n≤105 , 1≤k≤109 , 0≤b≤109 , 0≤s≤1018 ).
It is guaranteed that the sum of n over all test cases does not exceed 105 .
输出格式
For each test case print −1 if such array a does not exist. Otherwise print n non-negative integers a1,a2,…,an ( 0≤ai≤1018 ) — the answer.
输入输出样例
输入#1
8 1 6 3 100 3 6 3 12 3 6 3 19 5 4 7 38 5 4 7 80 99978 1000000000 100000000 1000000000000000000 1 1 0 0 4 1000000000 1000000000 1000000000000000000
输出#1
-1 -1 0 0 19 0 3 3 3 29 -1 -1 0 0 0 0 1000000000000000000
说明/提示
In the first, the second, the fifth and the sixth test cases of the example it is possible to show that such array does not exist.
In the third testcase of the example a=[0,0,19] . The sum of elements in it is equal to 19, the beauty of it is equal to (⌊60⌋+⌊60⌋+⌊619⌋)=(0+0+3)=3 .
In the fourth testcase of the example a=[0,3,3,3,29] . The sum of elements in it is equal to 38 , the beauty of it is equal to (0+0+0+0+7)=7 .