100m Race
Statement
Goal: There are [[N]] runners in a race who start at different times [[T]] and run at different speeds [[S]]. Determine which runner passes the 100m line last.
Input description
<<Line 1:>> [[N]]
<<Next [[N]] lines:>> Two space separated integers [[T]] and [[S]] for the start time in seconds and speed in meters/seconds
Output description
<<Line 1:>> Two space separated integers [[I]] and [[F]].
[[I]] is the index (0-based) of the last person to cross the 100m line, or {{-1}} if more than one person crosses last or nobody crosses at all.
[[F]] is the time in seconds since the race began that the last person crosses the 100m line, rounded up, or {{0}} if nobody crosses, if somebody has the speed of {{0}} m/s they will never reach the end and therefor not be the last
Constraints
0 ≤ [[N]] ≤ 100
0 ≤ [[T]] ≤ 15
0 ≤ [[S]] ≤ 15
Game modes
Fastest
Test cases
Slow to Fast Test
Input
3
0 2
3 4
5 10
Output
0 50
Slow to Fast Validator
Input
3
0 3
3 5
5 20
Output
0 34
Very Fast Test
Input
3
15 5
10 10
5 15
Output
0 35
Very Fast Validator
Input
3
5 5
10 10
15 15
Output
0 25
Same Time Test
Input
3
20 10
10 5
10 5
Output
-1 30
Same Time Validator
Input
3
0 5
10 10
0 5
Output
-1 20
Big Test
Input
3
27 2
48 1
19 3
Output
1 148
Big Validator
Input
3
0 1
57 3
28 2
Output
0 100
Nobody Test
Input
0
Output
-1 0
Nobody Validator
Input
0
Output
-1 0
So Slow Test
Input
2
3 0
1 0
Output
-1 0
So Slow Validator
Input
2
5 0
2 0
Output
-1 0
Lots Of Racers Test
Input
100
15 14
0 8
8 1
0 15
2 2
8 6
0 11
3 11
7 0
13 10
11 15
8 4
3 6
11 13
3 0
5 3
0 8
5 3
9 0
12 14
3 0
11 4
12 14
10 13
2 3
2 3
5 6
11 2
5 9
5 15
2 2
14 2
15 3
9 12
10 9
12 10
10 1
14 4
2 9
11 0
9 6
12 10
5 2
10 4
10 12
2 8
14 1
11 14
13 2
6 2
8 13
8 7
5 9
0 7
2 1
8 1
13 7
6 8
14 14
11 5
8 5
7 15
3 15
1 1
6 4
10 15
10 6
7 13
14 7
10 6
14 13
3 5
14 8
1 7
1 7
6 0
12 11
15 1
5 15
2 6
12 5
15 14
1 7
7 7
11 4
6 11
1 0
9 0
14 14
14 9
4 14
15 8
13 6
3 1
15 15
4 9
14 1
2 10
6 3
7 3
Output
77 115
Lots Of Racers Validator
Input
100
5 14
6 8
2 10
3 7
10 10
2 10
8 11
15 15
1 1
11 11
4 9
2 14
4 15
14 9
3 11
4 10
14 6
1 15
5 10
6 14
5 8
10 14
14 13
10 15
9 15
5 10
14 1
4 11
12 1
5 2
15 11
14 8
3 7
3 14
10 3
15 9
9 0
13 2
1 4
7 2
2 2
12 10
7 13
11 13
7 11
6 15
5 2
0 1
13 2
5 14
3 13
10 10
10 13
10 3
12 10
6 0
9 12
1 6
0 13
12 1
10 14
14 15
3 0
5 7
13 15
10 7
10 15
3 1
7 9
10 7
0 7
15 8
0 0
2 7
10 11
13 1
1 1
6 5
13 10
7 14
0 12
8 1
4 12
2 2
1 9
9 8
14 8
11 8
10 13
14 6
3 12
2 5
8 7
4 1
13 12
11 1
7 8
3 3
5 11
1 11
Output
26 114
A Few Test
Input
3
1 2
3 13
11 15
Output
0 51
A Few Validator
Input
4
8 4
14 11
11 12
8 11
Output
0 33
Who's Last? Test
Input
6
11 14
0 0
3 11
15 15
3 10
15 5
Output
5 35
Who's Last? Validator
Input
5
3 2
8 2
7 6
15 13
9 7
Output
1 58
Just U guys? Test
Input
2
14 1
13 0
Output
0 114
Just U guys? Validator
Input
3
13 1
5 7
3 13
Output
0 113
Last one promise! Test
Input
9
5 5
5 13
11 8
10 15
1 10
0 3
10 6
15 2
10 8
Output
7 65
Last one promise! Validator
Input
7
2 14
15 1
13 14
3 13
2 12
11 4
13 1
Output
1 115
Solution language
Solution
Stub generator input