Printed Circuit Board

Time limit0.1sMemory limit32 MB

Summary
Given a simple polygon and an external origin point, find all polygon vertices that can be connected to the origin by a segment not crossing any polygon edge.
Level

Hard8 of 10

Topics
Geometry, Sorting, Divide and conquer
Solved
No attempts yet

Problem

A printed circuit board (PCB) mechanically supports and electrically connects electronic components using conductive pathways etched from copper sheets that are laminated onto a nonconductive substrate.

Your company wants to build a new electronic device on a PCB. The design is partially finished and has the shape of a closed polygon with NN nodes numbered from 11 to NN. For every ii, node ii and node i+1i+1 are joined by a straight wire segment, and node NN is joined back to node 11. The wire segments are non-crossing: if two segments share a point, that point is an endpoint of both segments, and every node is the endpoint of exactly two segments. Each node has integer coordinates (x,y)(x, y), and the origin (0,0)(0, 0) is the lower-left corner of the board, which lies outside the polygon.

Write a program that determines every node that can be joined to the origin by a straight wire segment whose only common point with the polygon is that node itself.

Input

The first line contains one integer NN (1≤N≤2000001 \le N \le 200000), the number of nodes.

Each of the next NN lines contains two integers xx and yy (0<x,y≤10000000 < x, y \le 1000000): line i+1i+1 gives the coordinates of node ii.

Output

On the first line, print one integer MM: the number of nodes that can be joined to the origin by a straight wire segment meeting the polygon only at that node.

On the second line, print those node numbers in increasing order, separated by single spaces.

Hint

Examples3

  1. Example 1

    Input
    11
    7 6
    4 4
    3 2
    1 3
    9 9
    13 4
    8 1
    6 4
    9 5
    8 3
    11 5
    
    Expected output
    3
    3 4 7
    
  2. Example 2

    Input
    3
    1 1
    5 1
    3 5
    
    Expected output
    3
    1 2 3
    
  3. Example 3

    Input
    4
    2 2
    4 2
    4 4
    2 4
    
    Expected output
    3
    1 2 4