Question: To enhance data security and prevent data breaches, Uber does not store the distance and time of a ride directly. Instead, we store derived values

To enhance data security and prevent data breaches, Uber does not store the distance and time of a ride directly. Instead, we store derived values as unitless quantities: uSpeed => Value representing avg speed (Floor in case of non-int)
uAlpha => A value representing time plus distance
uBeta => A value representing time multiplied by distance
uDelta => A value representing time minus distance
Due to a technical issue, these values got mixed up, and the system forgot which value corresponds to which statistic. The values do not always appear in a specific order.
Your task is to return the distance and time corresponding
to the four given values. Assume the absolute value of
distance is always greater than time.
For example, if Time is 10 and Distance is 12.
uSpeed = Floor(12/10)1 uAlpha =12+10=22 uBeta 12*10=120 uDelta 10-12=-2
Input record can be [-2,1,22,120]
[execution time limit]0.5 seconds (cpp)
[memory limit]1 GB
[input] integer t
The first line contains an integer T, the number of test cases.
1<= T <=100000
[input] array.array.integer testCases
Each test case consists of four integers A,B,C,D representing the mixed-up values of uSpeed, uAlpha, uBeta and uDelta.
-10^9<= A,B,C,D <=10^9
[output] array.array.integer
For each test case, return two numbers, Distance followed by Time
If no such integers exist, return -1,-1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!