Problem B
Expeditious Cubing
![/problems/expeditiouscubing/file/statement/en/img-0001.jpg](/problems/expeditiouscubing/file/statement/en/img-0001.jpg)
Picture by Keqs on Wikimedia Commons, cc-by sa
Claire is competing in the most popular competition: speedsolving the $3\times 3\times 3$ Rubik’s cube, pictured on the right. Each contestant needs to solve the cube five times, each time with a different random scramble. After all solves are completed, the best and the worst times are discarded and the final score is the average of the remaining three times. The contestant with the smallest final score wins.
Claire has done well in the competition so far and is among the contenders for the overall victory. All the other contestants have already finished their five solves, but Claire has one solve remaining. By looking at the final scores of the other contestants, she has deduced her own target final score. As long as her final score is less than or equal to this target score, she will be declared the overall winner. Is it possible for her to win the competition, and if so, what is the worst time she can have on her last solve in order to do so?
Input
The input consists of:
-
One line with four real numbers $t_1$, $t_2$, $t_3$ and $t_4$, the times Claire got on her first four solves.
-
One line with a real number $t$, Claire’s target final score, the worst final score she can have in order to be declared the overall winner.
Each number is between $1$ and $20$, inclusive, and is given with exactly two decimal places.
Output
If it is not possible for Claire to win the event, output “impossible”. If she will win regardless of the time she gets on her last solve, output “infinite”. Otherwise, output the worst time she can have on her last solve in order to be declared the overall winner. Output the number to exactly two decimal places.
Sample Input 1 | Sample Output 1 |
---|---|
6.38 7.20 6.95 8.11 7.53 |
infinite |
Sample Input 2 | Sample Output 2 |
---|---|
6.38 7.20 6.95 8.11 6.99 |
6.82 |
Sample Input 3 | Sample Output 3 |
---|---|
6.38 7.20 6.95 8.11 6.45 |
impossible |