当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6609:Find the answer

题目描述
Given a sequence of n integers called W and an integer m. For each i (1 <= i <= n), you can choose some elements $W_k$ (1 <= k < i), and change them to zero to make $\sum_{j=1}^i$$W_j$<=m. So what's the minimum number of chosen elements to meet the requirements above?.
输入解释
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 <= $W_i$ <= m
输出解释
For each test case, you should output n integers in one line: i-th integer means the minimum number of chosen elements $W_k$ (1 <= k < i), and change them to zero to make $\sum_{j=1}^i$$W_j$<=m.
输入样例
2  
7 15  
1 2 3 4 5 6 7  
5 100  
80 40 40 40 60
输出样例
0 0 0 0 0 2 3  
0 1 1 2 3
来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6609

最后修改于 2020-10-25T23:32:46+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/4000MS(Java/Others) 65536/65536K(Java/Others)