Hide

Problem G
Overton Window

Languages en is

The Overton window is the range of policies politically acceptable to the mainstream population at a given time. It is important for politicians to find the Overton window so they can avoid causing outrage with policy proposals. They avoid being seen as extremist, they will only propose policies which are within the Overton window. The Overton window is defined as the set of policies formed by some weighted average of the voters’ ideal policies. Given a list of $n$ mainstream voters’ ideal policies, represented by points in the plane, find which voters define the extremal boundary of the Overton window. A voter contributes to defining the Overton window if removing that voter (and other voters with equal ideal policies) changes the Overton window.

Input

The first line contains an integer $n$, where $1 \leq n \leq 300\, 000$. Then $n$ lines follow, each of which contain two integers $x, y$, where $-10^9 \leq x, y \leq 10^9$.

Output

First output $k$, the number of voters which form the extremal boundary of the Overton window. Then output $k$ integers, the indices of the voters forming the boundary, such that the boundary is formed by adjacent voters in the output, as well as the first and last voter.

Give the lexicographical minimum rotation of these voters in counterclockwise order. If multiple voters have equal ideal policies, you should pick the one that appears first in the input.

Sample Input 1 Sample Output 1
1
0 0
1
1
Sample Input 2 Sample Output 2
3
0 0
2 -1
-2 1
2
2 3
Sample Input 3 Sample Output 3
7
0 0
0 1
-1 0
-10 -10
-10 10
5 5
6 6
5
1 7 2 5 4
Sample Input 4 Sample Output 4
6
-1000000000 -1000000000
999999998 1000000000
1000000000 999999996
-1 0
2 0
0 0
4
1 5 3 2

Please log in to submit a solution to this problem

Log in