Professor Filthy Frank has bought a new pet (whose name must remain undisclosed). He wants to prevent it from the horrible fate suffered by his previous hamster Stuart (which didn’t quite differ from that of his previous six pets). In particular, he wants to avoid using his sock to protect it from the cold. Can you find the warmest spot for Frank’s new pet?
Consider a bidimensional infinite world, where the temperature is given by the formula . Frank’s room is an -sided polygon determined by the intersection of half-planes, each one defined by the equation .
Input consist of several cases, each one with , , and , followed by triples defining the half-planes in any order. (For instance, below you can see the green room of the first sample case.) Assume , that at least or is non-zero, and that the resulting room has indeed sides.
Print the highest temperature inside each room with three digits after the decimal point. The input cases do not have precision issues.
The expected solution has cost better than .
(10,5)
(0,0)(2,0)(4,2)(3,4)(0,3)
(0,0)(0,5) (0,0)(5,0) (1,0)(1,5) (2,0)(2,5) (3,0)(3,5) (4,0)(4,5) (0,1)(5,1) (0,2)(5,2) (0,3)(5,3) (0,4)(5,4)
Input
5 1.0 0.5 -3.0 0.0 1.0 0.0 1.0 -3.0 9.0 -1.0 1.0 2.0 1.0 0.0 0.0 -2.0 -1.0 10.0 4 -1.0 -2.0 -4.0 1.0 0.0 1.0 -1.0 0.0 1.0 0.0 1.0 1.0 0.0 -1.0 1.0 3 1.23 -4.56 7.89 42.42 -53.53 64.64 -98.98 76.76 54.54 23.23 45.45 10.01
Output
2.000 -1.000 9.864