Difficulty Level: Hard

Submissions: 301 Accuracy:


[Bike Racing]

A Bike race is to be organized. There will be N bikers. You are given initial Speed of the ith Biker by Hi and the Acceleration of ith biker as Ai KiloMeters per Hour.

The organizers want the safety of the bikers and the viewers.They monitor the Total Speed on the racing track after every Hour.
A biker whose Speed is 'L' or more, is considered a Fast Biker.
To Calculate the Total speed on the track- They Add the speed of each Fast biker ,at that Hour. 
As soon as The total speed on the track is 'M' KiloMeters per Hour or more, The safety Alarm buzzes.
You need to tell what is the minimum number of Hours after which the safety alarm will buzz.

The first Line contains T- denoting the number of test cases.
The first line of each test case contains three space-separated integers N, M and L denoting the number of bikers and speed limit of the track respectively, and A fast Biker's Minimum Speed. 
Each of next N lines contains two space-separated integers denoting Hi and Ai respectively.

For each test case-Output a single integer denoting the minimum number of Hours after which alarm buzzes.

1 ≤ M,L ≤ 1e10
1 ≤ Hi, Ai ≤ 1e9

Sample Input:
3 400 120
20 20
50 70
20 90

Sample Output:

Speeds of all the Bikers at ith Minute
Biker1= 20 40 60 80 100 120 
Biker2= 50 120 190 260 330
Biker3= 20 110 200 290 380 

Total Initial speeds = 0 (Because none of the biker's speed is fast enough)
total Speed at 1st Hour= 120
total Speed at 2nd Hour= 190+200=390
total Speed at 3rd Hour= 260+290=550
Alarm will buzz at 3rd Hour.


** For More Input/Output Examples Use 'Expected Output' option **

Author: iamabjain

Set Default Code

It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use, generate link and share the link here.