#P7485. [2017年杭电多校]Rikka with Subset
[2017年杭电多校]Rikka with Subset
Rikka with Subset
Problem Description
As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: Yuta has positive and their sum is . Then for each subset of , Yuta calculates the sum of . Now, Yuta has got numbers between . For each , he counts the number of s he got as . Yuta shows Rikka the array and he wants Rikka to restore . It is too difficult for Rikka. Can you help her?
Input
The first line contains a number , the number of the testcases. For each testcase, the first line contains two numbers . The second line contains numbers .
Output
For each testcase, print a single line with numbers . It is guaranteed that there exists at least one solution. And if there are different solutions, print the lexicographic minimum one.
Sample Input
2
2 3
1 1 1 1
3 3
1 3 3 1
Sample Output
1 2
1 1 1
Hint
In the first sample, is . has four subsets and the sums of each subset are . So
Source
2017 Multi-University Training Contest - Team 5