#P3194. Visible Lines in the Upper Envelope

    ID: 16451 Type: Default 1000ms 256MiB

Visible Lines in the Upper Envelope

Visible Lines in the Upper Envelope

In an xyx-y coordinate plane, you are given nn lines L1,L2,,LnL_1, L_2, \dots, L_n, each defined in the form y=Ax+By = Ax+B (with A,B500000|A|,|B| \leq 500000) and no two lines are identical. When looking downward from y=+y = +\infty, if some segment of line LiL_i is visible (i.e. it appears on the upper envelope of all lines), then LiL_i is considered visible; otherwise, it is covered. For example, for the lines

  • $L_1: y=x$
  • $L_2: y=-x$
  • $L_3: y=0$

L1L_1 and L2L_2 are visible, while L3L_3 is covered.

Your task is to determine all visible lines. Output the indices of the visible lines (1-indexed) in increasing order. A line is visible if and only if there exists at least one xx for which its value is strictly maximum among all given lines.

inputFormat

The first line of input contains an integer nn (1n1051 \leq n \leq 10^5) representing the number of lines. Each of the following nn lines contains two integers AA and BB, representing a line y=Ax+By = Ax+B. It is guaranteed that no two lines are identical.

outputFormat

Output a single line containing the indices of all visible lines in increasing order, separated by a space.

sample

3
1 0
-1 0
0 0
1 2