Area Between Outer Hull and Inner Hull#6243

Area Between Outer Hull and Inner Hull

5 seconds
128 megabytes
Medium

Given a set of points on the plane, namely S = \{(x_0, y_0), (x_1, y_1), \ldots, (x_{N-1}, y_{N-1})\}, the outer hull of is simply just the convex hull of . It is a subset of points of which when joined by line segments will form a convex polygon of minimum area that includes all points of inside or on . Points of falling on but are not corner vertices of are not considered part of the convex hull. The inner hull of is obtained by getting the convex hull of S - Ho. That is, remove from set all points that belong to the outer hull , to get the set (S - Ho). Then compute the inner hull as the convex hull of (S - Ho).

For example given the set of points , B(2.0, 4.0), C(2.0, 2.0), D(1.0, 1.0), E(4.0, 1.0), F(0.0, 0.0), , and H(5.0, 0.0), the outer hull of can be computed as the set Ho = \{F, H, A, F\}. If we remove from , we get S - Ho = \{B, C, D, E, G\}. The inner hull of is computed as the convex hull of S - Ho, namely Hi = \{D, G, E, B, D\}. Now the area inside is \text{area}(Ho) = 12.5. The area inside is \text{area}(Hi) = 6.0. Thus the area between the outer hull and the inner hull is 12.5 - 6.0 = 6.5.

Your problem is, given a set of points, to write a program that computes the area between the outer hull of , and the inner hull of .

Input

The input consists of several problem sets. The first line of a problem set will contain the problemID and the value of . The value of will not exceed . The next lines of the problem set will contain the value of - and -coordinate (separated by a space) of a point, at one point per line. Each coordinate or will be a real number not exceeding in absolute value. The lines of the next problem set will immediately follow the previous problem set. A line with problemID of "ZZ" and a value of of indicates the end of input.

Output

For each problem set, print one line of the form "ProblemID id: area" where is the problemID given in the input, and is the area between the outer hull and the inner hull that you computed.

Express the area with decimal places.

Examples

Example 1

Loading
Loading