Given n points on the x-axis, we give arbitrary radius for each point such that each constructed circle doesn't overlap another constructed circle from another point. Which means these circles do not intersect each other, but one point still can lie on another circle boundary. Find the total maximum area of these circles?
My basic idea is to set the radius of the first point to be 'r' (0 <= r <= x - x), then the next radius will be (x - x - r), etc. Then I figure out the function F(x) which means the result of the problem. Find the maximum of this function seems to be right but in this case, it's not:
Ex: array of points X = [0, 1, 3, 6, 10]
mySol: array of radii R = [1, 0, 2, 1, 3] => result = 15*PI
rightAns: R = [ 1, 0, 2, 0, 4] => result = 21*PI (which is the maximum total area)
Which is the best approach for this problem?