Special Relativity
View as PDFJames "Chad" Su was drifting through an intersection when he was T-boned by a Tesla Roadster travelling at a significant fraction of the speed of light.
James and the Tesla driver disagree on when the street light opposite the Tesla turned green and are having trouble settling the dispute.
James isn't a fan of Einstein's shenanigans or getting his car wrecked, so he decides to try and get light speed Teslas banned from driving on city roads. In order to provide evidence for how problematic these vehicles are, he wants to know the sum of the differences in observed time at all points where such discrepancies can occur.
The city consists of  street lights and 
 drivers. The 
 street light's location is represented by the point 
. In James's universe, light travels at 
 units per second. At the instant captured by the problem input, every street light's colour has simultaneously changed relative to the plane.
The  driver is represented by a position vector 
 and a direction vector 
. Initially, the drivers are located at their position vector's coordinates - the point 
. Every second, their location is moved by the direction vector (i.e., 
).
The time at which a driver has seen a street light change colour is defined as the time at which the driver receives the first ray of new colour light from the street light.
Find the sum of the absolute time differences in between the times that every pair of drivers experiences every light change colour.
For this problem, Python users are recommended to use PyPy over CPython.
Note that an understanding of special relativity is not required to solve this problem.
Constraints
Assume that all measurements of length, position, and time are taken relative to the plane.
Subtask 1 [10%]
Subtask 2 [10%]
Subtask 3 [40%]
Subtask 4 [40%]
No additional constraints.
Input Specification
The first line of input contains 3 integers , 
, and 
 - the number of street lights, number of drivers, and the speed of light, respectively.
The next  lines contain 2 integers 
 and 
 - the 
 and 
 coordinates of the 
 streetlight, respectively.
The next  lines contain 4 integers 
, 
, 
, and 
 - the 
 driver's initial position vector's 
 and 
 components, and the 
 driver's direction vector's 
 and 
 components, respectively.
Output Specification
Output a single line with a single number - the sum of the absolute time differences in between the times that every pair of drivers experiences every light change colour.
More specifically, the value of the following expression:
Where  is the time at which the 
 driver experiences the 
 light change colour.
Output the result of the expression. If the correct answer is , the grader will view 
 as correct if 
 or 
.
Sample Input 1
1 2 15
0 0
-5 2 0 -6
-2 -10 -6 3
Sample Output 1
0.3333333333
Sample Explanation 1
The following GIF shows the first second of the motion, in which both observers witness the light change colour. The first observer to see the light views it at time , while the second views it at time 
, for a total time difference of 
. Note that any real number from 
 to 
 would have been accepted.

Comments