问题 2828 --Find the answer

2828: Find the answer

时间限制: 4 Sec  内存限制: 128 MB
提交: 15  解决: 14
[提交][状态][命题人:]

题目描述

输入

The first line contains an integer Q --- the number of test cases. 
For each test case: 
The first line contains two integers n and m --- n represents the number of elemens in sequence W and m is as described above. 
The second line contains n integers, which means the sequence W.

1 <= Q <= 15 
1 <= n <= 2*10^5 
1 <= m <= 10^9 
For each i, 1 <= Wi <= m

输出

For each test case, you should output n integers in one line: i-th integer means the minimum number of chosen elements Wk (1 <= k < i), and change them to zero to make ij=1Wj<=m.
样例输入
Copy
2  
7 15  
1 2 3 4 5 6 7  
5 100  
80 40 40 40 60
样例输出
Copy
0 0 0 0 0 2 3  
0 1 1 2 3

提示

来源

 

[提交][状态]