Easter Eggs
Time limit2sMemory limit512 MB
Choose a red egg set and a blue egg set from given plants, total N eggs, maximizing the minimum red-blue distance.
- Level
Hard8 of 10
- Topics
- Binary search, Graph, Union-find, Geometry
- Solved
- No attempts yet
Problem
Easter is coming, and the Easter Bunny decided to organise a chocolate egg hunt for the children. He hides two kinds of eggs: blue milk chocolate eggs and red dark chocolate eggs. The field holds blueberry plants and redberry plants, and the eggs go into those plants. A red egg has to go into a redberry plant and a blue egg into a blueberry plant.
The local government issued a permit for the event on the condition that exactly eggs are hidden. The government does not pay for the dental care of the local children, so the Bunny decides by himself how many eggs of each colour to hide.
By the yearly tradition, the first child to find both a red egg and a blue egg wins a big reward. To make the hunt as hard as possible, the Bunny wants to maximise the minimum distance between a red egg and a blue egg. To keep things fair, he hides at most one egg in each plant. Write a program that computes this value for him. Distances are Euclidean.
Input
The first line contains three integers , , : the number of eggs to hide, the number of blueberry plants, and the number of redberry plants.
Each of the next lines contains two integers , , the coordinates of a blueberry plant.
Each of the next lines contains two integers , , the coordinates of a redberry plant.
- ,
- The plants have pairwise distinct coordinates.
Output
Print on the first line the largest minimum distance between a red egg and a blue egg that the Bunny can achieve. Print rounded to exactly six digits after the decimal point.
Figure

The picture shows the second example input. The eggs are hidden in the four filled plants.