Select Train
Statement
Goal
There is a total of n trains going from stationEvery train stops at p different stations, at every station between
You have to reach station
Input
Line 1: An integer d for the distance between station A and station B in km.
Line 2: An integer n for the total amount of trains available.
Next n lines : A float s for the speed of the train measured in km/hr, An integer tun for the train's unique number, and a float p for the amount of stations between stationA and station B all separated by a space.
Line 2: An integer n for the total amount of trains available.
Next n lines : A float s for the speed of the train measured in km/hr, An integer tun for the train's unique number, and a float p for the amount of stations between station
Output
The unique number of the first train to reach station B
Constraints
1000 >= d >= 100
8 > n >= 2
200 >= s >= 80
50 >= p >= 2
tun is always made of 5 digits
8 > n >= 2
200 >= s >= 80
50 >= p >= 2
tun is always made of 5 digits
Example
Input
200 3 120 12230 3 160 23440 2 180 33250 7
Output
23440
Game modes
Fastest
Test cases
Example Test
Input
200
3
120 12230 3
160 23440 2
180 33250 7
Output
23440
Stage 1 Validator
Input
160
4
90 25667 2
120 46732 4
200 22674 3
180 77263 5
Output
22674
Stage 2 Test
Input
130
2
109 33567 3
110 44567 2
Output
44567
Stage 3 Validator
Input
670
6
120 22783 2
160 33678 3
200 27763 2
80 33678 4
180 44678 5
190 22982 3
Output
27763
Stage 4 Test
Input
300
2
170 33767 4
100 44930 3
Output
33767
Stage 5 Validator
Input
120
3
200 77777 3
130 36478 5
140 36784 4
Output
77777
Stage 6 Test
Input
439
5
120 27398 3
140 37485 3
160 38364 4
80 28353 2
150 38746 4
Output
37485
Stage 7 Validator
Input
1000
3
200 38453 4
150 37454 3
180 72354 5
Output
38453
Solution language
Solution
Stub generator input