There is a farm that may be treated as two-dimensional Euclidean plane. There are trees numbered . Each tree may be treated as a point on the plane, and the -th tree has coordinates . The coordinates of trees are pairwise distinct.
Mr. P will drive from the origin . In one round, Mr. P will choose a direction from left, right, up, 45 degrees upper left, and 45 degrees upper right such that if driving in the selected direction Mr. P can arrive at a tree he has never visited. Mr. P will drive straight along the selected direction and will arrive at the nearest unvisited tree in that direction. If there is no available direction, Mr. P will stop. Mr. P will follow the optimal route in the sense Mr. P will visit the most trees possible. If the optimal route is not unique, Mr. P may choose any one of them.
Unfortunately, Mr. S found that Mr. P's car will leave a rut on the farm. A rut may be treated as a line segment between two trees or between the origin and a tree.
There are a lot of visitors to the farm besides Mr. P, and they will choose an optimal route when visiting the trees. Mr. S believes ruts in directions other than left and right (i.e. up, 45 degrees upper left, or 45 degrees upper right) are not beautiful. Therefore, he will rent some road rollers to reinforce areas that might have ruts not in the left or right direction. More formally, the area that might have ruts not in the left or right direction are segments on the farm such that each segment is contained in some optimal route. The road rollers work as follows:
The road roller starts from the origin or any tree.
The road roller may move upwards, 45 degrees upper left, or 45 degrees upper right. The road roller may only stop or change direction under a tree.
The road roller may only pass through areas that may have ruts not in the left or right direction, but a given area may be passed by multiple road rollers.
Mr. P and Mr. S asks the following question: (1) find an optimal route for Mr. P (2) tell Mr. S the minimum number of road rollers required.
Input Specification
The first line of the input contains an integer denoting the number of trees. In the following lines, the -th line has two integers separated by a single space denoting the coordinate of -th tree.
Output Specification
The output contains 3 lines. The first line is an input denoting the maximum number of trees Mr. P may visit. The second line contains integers separated by a single space denoting the trees Mr. P shall visit. The third line contains a single integer denoting the minimum number of road rollers required.
Sample Input 1
6
-1 1
1 1
-2 2
0 8
0 9
0 10
Sample Output 1
3
2 1 3
3
Explanation for Sample Output 1
There are two optimal routes that visit 3 trees: or . Three road rollers are required. The routes of the road rollers are , , and respectively.
Sample Input 2
4
0 1
-2 1
2 1
3 2
Sample Output 2
4
1 2 3 4
2
Explanation for Sample Output 2
The optimal route is unique: . It is possible to visit four trees. After visiting , since the closest unvisited tree after departing from and moving right is , we may reach . But if we move along the route , since all trees to the right of have been visited, we will stop.
Since moving along and will leave ruts that are not in the left or right direction, we need two road rollers.
Constraints
Test Case | Additional Constraints | ||
---|---|---|---|
1 | |||
2 | |||
3 | |||
4 | |||
5 | The optimal route is unique. | ||
6 | |||
7 | |||
8 | All are unique. | ||
9 | |||
10 | |||
11 | For any integer , at most trees satisfy . Additionally, there exists an optimal solution such that the road rollers won't pass through the same place twice. | ||
12 | |||
13 | |||
14 | |||
15 | For any integer , at most trees satisfy . | ||
16 | |||
17 | |||
18 | |||
19 | |||
20 |
Scoring
For each test case:
- If the first line of the output is correct, of points will be awarded;
- If the first two lines are correct, of points will be awarded;
- If the output is completely correct, of points will be awarded.
Comments