Problem 2992 --Find the answer

2992: Find the answer

"
Time Limit $4$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $7$ 正确数量 $3$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 数据结构
Given a sequence of n integers called W and an integer m. For each i (1 <= i <= n), you can choose some elements Wk (1 <= k < i), and change them to zero to make ∑i j=1 Wj<=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 <= 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 ∑i j=1 Wj<=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

推荐代码 查看2992 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$457 $ms] intLSY 474014 2019-09-25 22:12:05
内存最少[$15936 $KB] intLSY 474014 2019-09-25 22:12:05
第一AC llmxby 470054 2019-09-19 12:17:04
第一挑战 cgj4992008 470022 2019-09-19 10:42:54

赛题来源/所属竞赛 2019 Multi-University Training Contest 3 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛
1407 2019CCPC模拟赛(秦皇岛站 安财贸9.19) 2019-09-19 09:00:00 请登录