ACM ICPC World Finals 2008
Given the y coordinate of the intersection of the two line segments, the area to the left of c is simply a quadratic polynomial in a1 , and the area to the right of c is a quadratic polynomial in b1 . Thus, the optimal values of a1 and b1 can be easily computed given the y coordinate at x = c. Trying βallβ possible values for this y coordinate (or using a more sophisticated numeric minimization method) gives the optimum values asked for in the problem.