As a preliminary step in developing an autonomous vehicle system, your team is seeking to prove that a central traffic controller can sound an alert when automobiles are likely to collide unless corrective actions are taken.
The test course consists of a number of straight tracks that intersect at a variety of angles. As cars pass sensors mounted on the tracks, their position and speed is recorded and sent to the central controller. The controller remembers its two most recent sets of readings for each car. We want the controller to sound the alert whenever two cars will, if they behave as predicted, pass "dangerously close" to one another any time within the next seconds (following the most recent of the sensor readings). For this purpose, consider that cars are dangerously close if they pass within ft. of one another. Cars are considered safe if their closest approach is at least ft apart. A passage within ft to ft is considered ambiguous.
Assume that
The cars remain on their straight course
The acceleration (change in speed per unit time) of each car remains constant over the time between observations and for the next sec, with the two exceptions given below.
Exception : if the car is decelerating, it stops decelerating if its speed reaches zero (cars do not shift into reverse).
Exception : if the car is accelerating, it stops accelerating if its speed reaches feet per second (about MPH).
Given the two most recent sets of reading for each of two cars, determine if they will pass within ft of each other within seconds of the last measurement.
There will be multiple test cases in the input. Each test case consists of four observations, one observation per line. The first two observations are for the first car, the second two observations are for the second car.
Each observation consists of four floating point numbers , , and , separated by single spaces, where:
is the time of the observation in seconds (0 \le t \le 120)
and give the position of the car at the time of the observation, in feet (-5000 \le x, y \le 5000)
is the speed in feet per second (0 \le s \le 80)
There will be no data sets in which the closest approach within the indicated time interval falls in the ambiguous ft to ft. range. The two observations for a given car will always occur at distinct times, and the first time for each car will be before the second time for that car.
Input is terminated with a line with four negative numbers.
For each data set, print a single line consisting of either if the cars will come within feet of each other within seconds following the maximum of the input times, or if not. Output no extra spaces, and do not separate answers with blank lines.
Esempio 1