Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You should complete the function and ensure it produces the correct output against all test cases possible within the constraints highlighted. The runtime of the
You should complete the function and ensure it produces the correct output against all test cases possible within the constraints highlighted. The runtime of the program is important so it is best to use an algorithm in the code which will not timeout.
Bullet Statistics HHackerRank A forensic scientist is studying the movement of a weirdly shaped bullet moving through some material of irregular density. Using her sophisticated equipment, she can obtain the speed in millimeters per millisecond (mm/ms) with which the bullet is moving for the entire length of its distance traveled. The recorded speed is always a positive integer Note that if at time tms, the bullet was at distance z mm, and her instrument recorded a speed of v mm/ms, then this means that at time t + 1 ms, the bullet was at a distance u mm. Along the trajectory of the bullet, she has a number of specially marked points, which are at known distances along the path. She wants to know the earliest time, to the nearest millisecond, when the bullet would have reached each landmark. If the bullet never reaches a landmark, she reports the time as-1, otherwise, she reports the smallest number of milliseconds after which the bullet would have either arrived at, or just passed, the landmark. Input Format Line 1: the total time (in milliseconds) for which data was collected. Line 2: U1 . . . ty the instantaneous velocities measured for each millisecond of the experiment. Line 3: n the total number of landmark points to be queried Line 4: p1..Pn the distances in mm of the landmark points being queried (not in any particular order) Constraints 1st s108 1n 105 1 v103 (1it 0 Sp 10 (for1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started