P6237 [CEOI 2012] Printed Circuit Board

Description

You are given a simple polygon with $n$ vertices. For each vertex, if the line segment connecting it to the origin intersects the polygon only at this vertex, then this vertex is considered valid. Your task is to output the indices of all valid vertices. ![](https://cdn.luogu.com.cn/upload/image_hosting/beasw2yx.png)

Input Format

The first line contains a positive integer $n$. The next $n$ lines each contain two positive integers not exceeding $10^6$, giving the coordinates of each vertex in order. The vertices are numbered $1,2,\ldots,n$ in the input order, and they are guaranteed to be given in either clockwise or counterclockwise order.

Output Format

The first line contains a positive integer $m$, the number of valid vertices. The second line contains $m$ positive integers, in increasing order, giving the indices of the valid vertices.

Explanation/Hint

Constraints: for $100\%$ of the testdata, $1 \le n \le 2 \times 10^5$. Translated by ChatGPT 5