Problem 108: Chicken

(U.M. ACM Runoffs 2002, problem 1)

Description

      The reckless teenagers of Six-Toe county, Arkansas like to play the game of chicken, in which they drive directly towards each other at the maximum speeds their cars can manage, and the one who swerves out of the way first is declared the winner and totally cool. However, being reckless teenagers, and the demented products of centuries of sibling marriages, none of them ever swerves out of the way. It is fortunate that they breed so prodigiously, or there would be none left.

      An entrepreneur has measured the capabilities of all of their cars, and wants to work out exactly where all fatal crashes will occur, so that he can set up a video camera at exactly the right spot and sell the recordings to CNN for use in one of their insightful and not-at-all-gratuitous specials.

      His task is possible because you are going to do the programming for him, and the kids have a very simple set-up. They always race towards each other along a straight track exactly 5280 feet long. At the start of the race, their cars always instantly jump to their maximum accelerations, which are maintained until they reach their maximum velocities. Once at maximum velocity, acceleration drops instantly to zero, and the car continues at maximum velocity.

      The violence of any collision is entirely determined by the closing velocity of the two vehicles at the time of impact (i.e. the sum of their velocities towards each other). In any collision with a closing velocity of greater than 100 feet per second everyone involved is killed. At velocities not greater than 100 feet per second everyone survives.

      The input to your program will consist of a sequence of records, each occupying exactly one line. Each line has three space-separated data items. The first is the (one) name of one of the reckless teenagers; the second is the maximum acceleration of his car in feet per second per second; the third is the maximum velocity of his car in feet per second. No name will contain any spaces or be more than 25 characters long. No velocity or acceleration will be negative or greater than 1000.0.

      The output of your program should be a list of the outcomes of all possible races between those participants, in the order in which they appeared (for example, if there are three teenagers named A, B, C, entered in that order, there are three possible races: A against B, A against C, and B against C, which should be listed in that order). For each possible race, list the names of the participants (in the indicated order), followed by either the words "all survive" or two numbers: the time at which a fatal collision occurs (in seconds from the beginning of the race, rounded t o the nearest tenth of a second), and the distance covered by the first-listed participant before the collision (in feet, rounded to the nearest foot). The four things printed on each line should be separated by single spaces.

Sample Input

Dingus 10.0 200.0
Cletus 10.0 200.0
Jebediah 1.0 40.0
Buttford 1.0 40.0

Sample Output

Dingus Cletus 23.2 2640
Dingus Jebediah 33.6 4716
Dingus Buttford 33.6 4716
Cletus Jebediah 33.6 4716
Cletus Buttford 33.6 4716
Jebediah Buttford all survive

End of Problem