QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 128 MB Total points: 100

#16025. 可见直线

Statistics

题目描述

假设 $xOy$ 平面上有 $n$ 条不垂直于 $x$ 轴的直线 $L_1, L_2, \ldots, L_n$,若站在 $y$ 轴上 $y$ 值为正无穷大的高度往下观察,至少能够看到直线 $L_i$ 的某个子线段,则称 $L_i$ 是可见的;否则称 $L_i$ 是被覆盖的。

例如,三条直线为:$L_1: y = -x$;$L_2: y = x$;$L_3: y = 0$;则 $L_1$ 和 $L_2$ 是可见的,而 $L_3$ 是被覆盖的。

现在的任务是:给定 $n$ 条直线 $L_1, L_2, \ldots, L_n$,请你编程求出所有可见的直线。为简单起见,假设所有直线都可写为 $Y=AX+B$ 的形式,其中 $A$ 和 $B$ 为绝对值小于 $500000$ 的整数,并且 $n$ 条直线中没有两条直线是重合的。

输入格式

第一行包含一个整数 $n$,表示直线条数。接下来 $n$ 行,每行有两个用空格隔开的整数,第 $i+1$ 行的两个整数分别对应直线 $L_i$ 的 $A_i$ 与 $B_i$。输入保证 $-500000 < A_i, B_i < 500000$,$0 < n < 50000$,并且没有重合的直线。

输出格式

仅包含一行,为 $m$ 个整数 $t_1, t_2, \ldots, t_m$,表示 $L_{t_1}, L_{t_2}, \ldots, L_{t_m}$ 是可见的。你的程序必须保证序列 $t_1, t_2, \ldots, t_m$ 单调递增,并且相邻整数间写一个空格。

样例数据

样例 1 输入

3
-1 0
1 0
0 0

样例 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.