LCC '25 Contest 2 S2 - Reading
View as PDFYou are working on a project that takes hours to finish. The project is due in
days, and you can start working on the project on any of the days from
to
. However, you are very busy, and on the
day, you only have
hours where you will be able to work on the project. Additionally, once you start the project, you must work on it on all consecutive days that follow, until you finish the project. You want to figure out what day you should start the project, such that the number of days it takes you to finish the project is minimal.
Input Specification
The first line contains .
The second line contains integers,
.
Output Specification
The start day that gives the minimum days to finish the project. It is guaranteed that it is possible to finish the project in days.
If there are multiple possible such days, output the earliest one.
Constraints
Subtask 1 [50%]
Subtask 2 [50%]
Sample Input 1
6 10
4 2 1 5 5 3
Output for Sample Input 1
4
Explanation of Output for Sample Input 1
You have hours to work on the project on both days
and
. Thus, if you start on day
, you can finish the project in
days, which in this case, is the minimum possible number of days.
Sample Input 2
5 4
1 1 1 1 1
Output for Sample Input 2
1
Comments