Its the medal distribution ceremony.10^6 police officers,numbered from one to 10^6,are standing in a line.There are N(1<=N<=1000)iterations of medal distribution.
In iteration i(0 < = i < N),count [i] (1<=count[i]<=100) medals are given to all officers from [i] to [i] (1<=from[i]<=to[i]<=to[i]<=10^6).
if we sum up the number of medals recived starting from the first officer,who would be the first officer for which the cumulative sum exceeds a given medal count THERESOLD(1<=THERESOLD<=10^9)?
yor are given 5 inputs:
input1=N,the number of iterations
input2=count,the array of medals counts in each iteration
input3=from,the array of starting indices in each iteration
input4=to,the aray of ending indices in each iteration
input5=THERESHOLD,the medal count threshold
AN integer,representing the number of the first officer such that the cumulative sum of medals from the first officer upto this officer exceeds THERESHOLD. The output should be -1 if such an officer does not exist .
Do not change the function and parameter names given in editor code.
Do not include any new libraries in the code.
You need to return the required output in the given function.
Return type must be the same as mentioned in the problem statement.
Do not print any variables in the code.
Do not write main function.
1 medal is given to each of the officers 1 to 10.Officer is the first officer for which the cumulative sum starting from first officer exceeds 2.