All in good fun!
Time limit1sMemory limit512 MB
Given three non-parallel lines, find the minimum possible value of the largest distance from a point to any of the three lines.
- Level
Hard8 of 10
- Topics
- Geometry, Binary search, Math, Implementation
- Solved
- No attempts yet
Problem
Policeman Biteusz loves pranking his friends from the police station. For example, his last joke was signing up his friend Bajteusz for patrolling the city on all Sundays and holidays left this year. However, Biteusz hasn't been so happy since he heard about the new work. Biteusz has to patrol three designated streets. Roads in Bajtocja are straight and no two streets are parallel, so he will have to patrol some, perhaps degenerate to a point, triangle. The policeman will stand at the best place possible, so as to minimize the maximum distance which he'd possibly have to travel when called to run to the specified street. Biteusz has been wondering how far he will have to run when called. Help him and calculate the minimum distance!
Input
In the first line one integer is given, denoting number of testcases described in following lines.
The first line of each test case contains , the number of roads in Bajtocja. Each of the next lines contains three integers , , , the description of the -th road, meaning that the road is a line fulfilling the equation:
Output
For each test case you should print the minimum distance which Biteusz will have to travel. Your answer will be accepted if the absolute or relative error doesn't exceed .
Constraints
- No two given lines are parallel.