Lying From You
Time limit10sMemory limit512 MB
Given n lines y = a_i x + b_i, change coefficients at L1 cost so all lines pass through one point; find the infimum total cost.
- Level
Hard8 of 10
- Topics
- Math, Geometry, Binary search, Greedy
- Solved
- No attempts yet
Problem
You are given lines on the plane, each defined by an equation of the form . Changing the coefficients of one line from to costs rubles. You can perform this operation any number of times on any lines, and the new coefficients can be any real numbers. The goal is to make all the lines pass through a single point.
Let be the set of total costs of operations that achieve the goal. Find , the greatest lower bound on the total cost.
Input
The first line contains a positive integer (), the number of lines.
Each of the next lines contains two integers and ().
Output
Print the answer on a single line with absolute or relative error no more than .
Hint
In the first example, it is enough to change of the first line to .