#P13402. [GCJ 2010 #2] Grazing Google Goats
[GCJ 2010 #2] Grazing Google Goats
题目描述
Farmer John has recently acquired a nice herd of goats for his field. Each goat will be tied to a pole at some position using a rope of length . This means that the goat will be able to travel anywhere in the field that is within distance of the point , but nowhere else. (The field is large and flat, so you can think of it as an infinite two-dimensional plane.)
Farmer John already has the pole positions picked out from his last herd of goats, but he has to choose the rope lengths. There are two factors that make this decision tricky:
- The goats all need to be able to reach a single water bucket. Farmer John has not yet decided where to place this bucket. He has reduced the choice to a set of positions , but he is not sure which one to use.
- The goats are ill-tempered, and when they get together, they sometimes get in noisy fights. For everyone's peace of mind, Farmer John wants to minimize the area that can be reached by all the goats.
Unfortunately, Farmer John is not very good at geometry, and he needs your help for this part!
For each bucket position , you should choose rope lengths so as to minimize the area that can be reached by every goat when the bucket is located at position . You should then calculate each of these areas .
Example
In the picture below, there are four blue points, corresponding to the pole positions: , , , and . There are also two red points, corresponding to the potential bucket positions: and . You need to calculate and , the areas of the two shaded regions.
输入格式
The first line of the input gives the number of test cases, . test cases follow. Each test case begins with a line containing the integers and .
The next lines contain the positions , one per line. This is followed by lines, containing the positions , one per line.
Each of these lines contains the corresponding position's and coordinates, separated by a single space.
输出格式
For each test case, output one line containing "Case #: ... ", where is the case number (starting from 1), and ... are the values defined above. Answers with a relative or absolute error of at most will be considered correct.
3
2 3
0 20
20 0
-20 10
40 20
0 19
4 2
0 0
100 100
300 0
380 90
400 100
1000 5
3 1
0 0
10 10
20 0
10 5
Case #1: 1264.9865911 1713.2741229 0.2939440
Case #2: 1518.9063729 1193932.9692206
Case #3: 0.0
提示
Limits
- All coordinates are integers between and .
- The positions are all distinct and no three are collinear.
Small dataset (7 Pts, Test set 1 - Visible)
- Time limit:
303 seconds. - .
- .
- .
Large dataset (25 Pts, Test set 2 - Hidden)
- Time limit:
12012 seconds. - .
- .
- .