TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Some of you know an old story of Voronoi Island. There were N liege lords and they are always involved
in territorial disputes. The residents of the island were despaired of the disputes.


One day, a clever lord proposed to stop the disputes and divide the island fairly. His idea was to divide the
island such that any piece of area belongs to the load of the nearest castle. The method is called Voronoi
Division today.


Actually, there are many aspects of whether the method is fair. According to one historian, the clever
lord suggested the method because he could gain broader area than other lords.


Your task is to write a program to calculate the size of the area each lord can gain. You may assume that
Voronoi Island has a convex shape.

Input Format

There are multiple test cases in the input, ended by EOF. For each test case, the input has the following format:



N M
Ix1 Iy1
Ix2 Iy2
. . .
IxN IyN
Cx1 Cy1
Cx2 Cy2
. . .
CxM CyM

N is the number of the vertices of Voronoi Island; M is the number of the liege lords; (Ixi, Iyi) denotes
the coordinate of the i-th vertex; (Cxi,Cyi) denotes the coordinate of the castle of the i-the lord.


The input meets the following constraints: 3 ≤ N ≤ 10, 2 ≤ M ≤ 10, −100 ≤ Ixi, Iyi ,Cxi,Cyi ≤ 100. The vertices are given counterclockwise. All the coordinates are integers.

Output Format

Print the area gained by each liege lord with an absolute error of at most 10−4. You may output any number of digits after the decimal point. The order of the output areas must match that of the lords in the
input.

Sample Input 1

3 3
0 0
8 0
0 8
2 2
4 2
2 4

3 3
0 0
8 0
0 8
2 2
4 2
2 4

Sample Output 1

9.0
11.5
11.5
9.0
11.5
11.5

Hints

Info: 本題輸出為浮點數,絕對或相對誤差 1e-4 以下視為正確

Problem Source

Migrated from old NTUJ.

ICPC OB會 2009夏合宿day2 pF

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 200