Is there really a monster living in Loch Ness?
Did the lost city of Atlantis ever exist?
Are UFOs tricks of the light, or actually vehicles from outer space?
Who is responsible for the strange patterns called crop circles——clever hoaxers or alien beings?
As we can see, there are so many mysterious places, creatures and events in the world which puzzled people for centuries. In this problem, we won’t go through all that puzzles. Which we are interested in is this one -- crop circles.
You have probably seen pictures of crop circles. (i.e. see above) They are circular patterns which mysteriously appear in fields of crop, such as wheat and barley. For research, we model these patterns as N circles in the plane and number them with 1, 2, …, N. Each of them has its center (Xi, Yi), radius Ri and an importance value Vi which is evaluated by the scientists.
After our observation, we found that there aren’t any two circles touch each other in the crop circles. But it’s possible that a circle is completely within another one. When we are in a certain circle, we should pass through its borderline once in order to get out from it.
For two distinct circles A and B, if one can go to B from A without passing through more than K borderlines, we say that A and B are connected. Here comes the problem: For all connected cycle pairs (A, B), what’s the maximum difference of the importance value between them? The difference of the importance value between A and B can be defined as |VA – VB|.
For example, look at the picture below. For K = 3, the optimal solution is to select the circle 1 and 3 which make the difference of importance value 220. And there are 3 borderlines between circle 1 and 3.
|V5 – V1| = 300, which is larger than 220, but circle 5 and circle 1 are not connected. There’re 4 borderlines between them, so we won’t consider these kinds of pairs.