欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1593C.Save More Mice
Save More Mice
There are one cat, mice, and one hole on a coordinate line. The cat is located at the point , the hole is located at the point . All mice are located between the cat and the hole: the -th mouse is located at the point (). At each point, many mice can be located.
In one second, the following happens. First, exactly one mouse moves to the right by . If the mouse reaches the hole, it hides (i.e. the mouse will not any more move to any point and will not be eaten by the cat). Then (after that the mouse has finished its move) the cat moves to the right by . If at the new cat's position, some mice are located, the cat eats them (they will not be able to move after that). The actions are performed until any mouse hasn't been hidden or isn't eaten.
In other words, the first move is made by a mouse. If the mouse has reached the hole, it's saved. Then the cat makes a move. The cat eats the mice located at the pointed the cat has reached (if the cat has reached the hole, it eats nobody).
Each second, you can select a mouse that will make a move. What is the maximum number of mice that can reach the hole without being eaten?
Input
The first line contains one integer () — the number of test cases. Then test cases follow.
Each test case consists of two lines. The first line contains two integers and (, ). The second line contains integers () — the initial coordinates of the mice.
It is guaranteed that the sum of all given in the input doesn't exceed .
Output
For each test case output on a separate line an integer () — the maximum number of mice that can reach the hole without being eaten.
Samples
3
10 6
8 7 5 4 9 4
2 8
1 1 1 1 1 1 1 1
12 11
1 2 3 4 5 6 7 8 9 10 11
3
1
4
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |