Polygon Partition

2.2

4 votes
Mathematics, Hard, Polygon Basic, Polygon
Problem

You are given n points in a plane. You would like choose a number k and partition the points into disjoint sets P1,P2,,Pk.

 

The score of your partition will be as follows. Let P be a point set, and let h(P) denote the convex hull of the point set. Let A(x) denote the area of polygon x. Your score is equal to iA(h(Pi)). You would like to maximize this score. Note that the convex hulls are allowed to overlap.

 

Note that the convex hull can contain 1 or 2 points, in which case, its area is zero.

 

Test Data Generation

First, a number n is chosen randomly from 20 to 100.
Next, the coordinates of each point is chosen uniformly at random from 0 to 103. Note that it is possible two points can coincide.
Note that the sample will not appear in the main tests, it is only to show the input/output format.

 

Input Format

The first line will contain a single integer n (20n100).
The next n lines will contain two integers xi,yi (0xi,yi103), denoting a point with coordinates (xi,yi). Note that points are not guaranteed to be distinct.

 

Output Format

On the first line, output a single integer k (1kn), the number of sets in your partition.
On the next k lines, print the elements of the partition. On the i-th of these k lines, first print the integer li (1lin), and then li indices of points forming the i-th set. Points are numbered starting from 1. Each index from 1 to n must appear in exactly one set. 

Sample Input
3
0 0
0 1
1 0
Sample Output
1
3 1 2 3
Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

.

Editor Image

?