CF1822A.TubeTube Feed
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 t seconds for lunch, so he asks you for help with the selection of video.
The TubeTube feed is a list of n videos, indexed from 1 to n. The i-th video lasts ai seconds and has an entertainment value bi. Initially, the feed is opened on the first video, and Mushroom can skip to the next video in 1 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 t seconds. If there are several of them, he wants to choose the most entertaining one. Print the index of any appropriate video, or −1 if there is no such.
蘑菇·菲利波夫为自己做了一顿饭,吃饭时他决定在 TubeTube 上看一个视频。他午餐时间不能超过 t 秒,因此他请你帮忙挑选合适的视频。
TubeTube 的信息流是一个包含 n 个视频的列表,编号从 1 到 n。第 i 个视频时长为 ai 秒,娱乐值为 bi。初始时信息流打开在第一个视频上,蘑菇可以在 1 秒内跳转到下一个视频(如果下一个视频存在)。蘑菇可以跳过任意数量的视频(包括零次)。
请帮助蘑菇选择一个他能在 t 秒内打开并完整观看的视频。如果有多个满足条件的视频,他希望选择娱乐值最高的那个。输出任意一个符合条件的视频的编号;若不存在这样的视频,则输出 −1。
输入格式
The first line of the input data contains a single integer q (1≤q≤1000) — 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 n and t (1≤n≤50, 1≤t≤200) — the number of videos in the feed and seconds for lunch, respectively.
The second line of a test case contains n integers a1,a2,a3,…,an (1≤ai≤100) — durations of videos.
The third line of a test case contains n integers b1,b2,b3,…,bn (1≤bi≤100) — entertainment values of videos.
输入数据的第一行包含一个整数 q(1≤q≤1000),表示测试用例的数量。
随后是各测试用例的描述。
每个测试用例的第一行包含两个整数 n 和 t(1≤n≤50,1≤t≤200),分别表示信息流中视频的数量以及午餐时间(单位:秒)。
每个测试用例的第二行包含 n 个整数 a1,a2,a3,…,an(1≤ai≤100),表示各视频的时长。
每个测试用例的第三行包含 n 个整数 b1,b2,b3,…,bn(1≤bi≤100),表示各视频的娱乐值。
输出格式
Output q 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 −1, if there is no video he can watch during his lunch break.
输出 q 个整数,每个整数对应一个测试用例的答案。作为答案,请输出蘑菇(Mushroom)在午休时间内能够观看的娱乐性最高的视频的索引。若存在多个满足条件的答案,可任选其一输出。若他在午休期间无法观看任何视频,则输出 −1。
输入输出样例
输入#1
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
输出#1
3 2 3 -1 2
输入解题思路,AI测评打分。不知道怎么写?