시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB0000.000%

문제

Farmer John has recently acquired a nice herd of N goats for his field. Each goat i will be tied to a pole at some position Pi using a rope of length Li. This means that the goat will be able to travel anywhere in the field that is within distance Li of the point Pi, 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 {Q1Q2, ..., QM}, 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 A 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 Qj, you should choose rope lengths so as to minimize the area Ajthat can be reached by every goat when the bucket is located at position Qj. You should then calculate each of these areas Aj.

Example

In the picture below, there are four blue points, corresponding to the pole positions: P1P2P3, and P4. There are also two red points, corresponding to the potential bucket positions: Q1 and Q2. You need to calculate A1 and A2, the areas of the two shaded regions.


   

입력

The first line of the input gives the number of test cases, TT test cases follow. Each test case begins with a line containing the integers N and M.

The next N lines contain the positions P1P2, ..., PN, one per line. This is followed by Mlines, containing the positions Q1Q2, ..., QM, one per line.

Each of these N + M lines contains the corresponding position's x and y coordinates, separated by a single space.

Limits

  • All coordinates are integers between -10,000 and 10,000.
  • The positions P1P2, ..., PNQ1Q2, ..., QM are all distinct and no three are collinear.
  • 1 ≤ T ≤ 10.
  • 2 ≤ N ≤ 5,000.
  • 1 ≤ M ≤ 1,000.

출력

For each test case, output one line containing "Case #x: A1 A2 ... AM", where x is the case number (starting from 1), and A1 A2 ... AM are the values defined above. Answers with a relative or absolute error of at most 10-6 will be considered correct.

예제 입력 1

2
4 2
0 0
100 100
300 0
380 90
400 100
1000 5
3 1
0 0
10 10
20 0
10 5

예제 출력 1

Case #1: 1518.9063729 1193932.9692206
Case #2: 0.0 

출처

Contest > Google > Code Jam > Google Code Jam 2010 > Round 2 D2번

채점 및 기타 정보

  • 예제는 채점하지 않는다.