QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 128 MB Puntuación total: 100

#16025. Visible Lines

Estadísticas

Suppose there are $n$ lines $L_1, L_2, \ldots, L_n$ in the $xOy$ plane, none of which are perpendicular to the $x$-axis. If, when looking down from a height of positive infinity on the $y$-axis, at least one sub-segment of line $L_i$ is visible, then $L_i$ is said to be visible; otherwise, $L_i$ is said to be covered.

For example, given three lines: $L_1: y = -x$, $L_2: y = x$, and $L_3: y = 0$, then $L_1$ and $L_2$ are visible, while $L_3$ is covered.

Your task is: given $n$ lines $L_1, L_2, \ldots, L_n$, write a program to find all visible lines. For simplicity, assume all lines can be written in the form $Y=AX+B$, where $A$ and $B$ are integers with absolute values less than $500000$, and no two lines are identical.

Input

The first line contains an integer $n$, representing the number of lines. The next $n$ lines each contain two space-separated integers; the two integers on the $(i+1)$-th line correspond to $A_i$ and $B_i$ for line $L_i$. It is guaranteed that $-500000 < A_i, B_i < 500000$, $0 < n < 50000$, and no two lines are identical.

Output

Output a single line containing $m$ integers $t_1, t_2, \ldots, t_m$, representing that $L_{t_1}, L_{t_2}, \ldots, L_{t_m}$ are visible. Your program must ensure that the sequence $t_1, t_2, \ldots, t_m$ is in increasing order, with a single space between adjacent integers.

Examples

Input 1

3
-1 0
1 0
0 0

Output 1

1 2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.