시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
5 초 | 512 MB | 0 | 0 | 0 | 0.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:
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.
In the picture below, there are four blue points, corresponding to the pole positions: P1, P2, P3, 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, T. T test cases follow. Each test case begins with a line containing the integers N and M.
The next N lines contain the positions P1, P2, ..., PN, one per line. This is followed by Mlines, containing the positions Q1, Q2, ..., QM, one per line.
Each of these N + M lines contains the corresponding position's x and y coordinates, separated by a single space.
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.
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
Case #1: 1518.9063729 1193932.9692206 Case #2: 0.0
Contest > Google > Code Jam > Google Code Jam 2010 > Round 2 D2번