The Avaricious ISP
Time limit1sMemory limit128 MB
Choose two disjoint disks over weighted points to maximize the product of the covered weight sums.
- Level
Hard8 of 10
- Topics
- Geometry, Sorting, Two pointers
- Solved
- No attempts yet
Problem
You run an internet service provider that charges by traffic. Your network manager insists on building the network from exactly two wireless antennas joined by one underground cable. Each antenna covers a circle centered on itself and you may pick the radius freely. No point of the plane may be covered by both antennas, because a device sitting where the two coverage areas overlap is confused to death.
Potential customers sit at known points of the plane. A customer joins the network if one of the two antennas covers her. Customer has a traffic desire . When customers and are both covered, the daily traffic between them is .
The only traffic you can measure is the traffic that passes through the underground cable, that is, the traffic between pairs of customers attached to different antennas. Choose the position and the radius of both antennas so that this traffic is as large as possible.
Input
The input holds several test cases. The first line of each test case has one integer (), the number of potential customers. Each of the next lines has the traffic desire () followed by the coordinates , () of one potential customer, all integers. The input ends with a line containing a single 0.
In every test case, no three potential customers lie on one straight line.
Output
For each test case, print one line with the largest traffic that can pass through the underground cable when you choose the best position and radius for each antenna.