欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1822A.TubeTube Feed
TubeTube Feed
Mushroom Filippov cooked himself a meal and while having his lunch, he decided to watch a video on TubeTube. He can not spend more than seconds for lunch, so he asks you for help with the selection of video.
The TubeTube feed is a list of videos, indexed from to . The -th video lasts seconds and has an entertainment value . Initially, the feed is opened on the first video, and Mushroom can skip to the next video in second (if the next video exists). Mushroom can skip videos any number of times (including zero).
Help Mushroom choose one video that he can open and watch in seconds. If there are several of them, he wants to choose the most entertaining one. Print the index of any appropriate video, or if there is no such.
Input
The first line of the input data contains a single integer () — the number of test cases in the test.
The description of the test cases follows.
The first line of a test case contains two integers and (, ) — the number of videos in the feed and seconds for lunch, respectively.
The second line of a test case contains integers () — durations of videos.
The third line of a test case contains integers () — entertainment values of videos.
Output
Output integers, each of which is the answer to the corresponding test case. As an answer, output the index of the most entertaining video that Mushroom will have time to watch. If there are several answers, you are allowed to output any of them. Output , if there is no video he can watch during his lunch break.
Samples
5
5 9
1 5 7 6 6
3 4 7 1 9
4 4
4 3 3 2
1 2 3 4
5 7
5 5 5 5 5
2 1 3 9 7
4 33
54 71 69 96
42 24 99 1
2 179
55 66
77 88
3
2
3
-1
2
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |