CF593B.Anton and Lines
普及/提高-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = k__i·x + b__i. It was necessary to determine whether there is at least one point of intersection of two of these lines, that lays strictly inside the strip between _x_1 < _x_2. In other words, is it true that there are 1 ≤ i < j ≤ n and x', y', such that:
- y' = k__i * x' + b__i, that is, point (x', y') belongs to the line number i;
- y' = k__j * x' + b__j, that is, point (x', y') belongs to the line number j;
- _x_1 < x' < _x_2, that is, point (x', y') lies inside the strip bounded by _x_1 < _x_2.
You can't leave Anton in trouble, can you? Write a program that solves the given task.
老师给安东布置了一大堆几何作业,但他没有做(像往常一样),因为他参加了 Codeforces 上的一场常规比赛。题目中给出了一组 n 条直线,每条直线由方程 y=ki⋅x+bi 定义。要求判断:是否存在至少一对直线,其交点严格位于 x1<x2 所定义的竖直条带内部。换言之,是否满足:存在 1≤i<j≤n 以及点 (x′,y′),使得:
- y′=ki⋅x′+bi,即点 (x′,y′) 在第 i 条直线上;
- y′=kj⋅x′+bj,即点 (x′,y′) 在第 j 条直线上;
- x1<x′<x2,即点 (x′,y′) 位于由 x1<x2 界定的条带内部。
你总不能让安东陷入困境吧?请编写一个程序来解决该问题。
输入格式
The first line of the input contains an integer n (2 ≤ n ≤ 100 000) — the number of lines in the task given to Anton. The second line contains integers _x_1 and _x_2 ( - 1 000 000 ≤ _x_1 < _x_2 ≤ 1 000 000) defining the strip inside which you need to find a point of intersection of at least two lines.
The following n lines contain integers k__i, b__i ( - 1 000 000 ≤ k__i, b__i ≤ 1 000 000) — the descriptions of the lines. It is guaranteed that all lines are pairwise distinct, that is, for any two i ≠ j it is true that either k__i ≠ k__j, or b__i ≠ b__j.
输入的第一行包含一个整数 n(2≤n≤100000)—— 表示 Anton 所需处理的直线数量。
第二行包含两个整数 x1 和 x2(−1000000≤x1<x2≤1000000),定义了需要寻找至少两条直线交点的竖直条带区间。
接下来的 n 行,每行包含两个整数 ki 和 bi(−1000000≤ki,bi≤1000000)—— 描述第 i 条直线。
保证所有直线两两互不相同,即对任意 i=j,均有 ki=kj 或 bi=bj。
输出格式
Print "Yes" (without quotes), if there is at least one intersection of two distinct lines, located strictly inside the strip. Otherwise print "No" (without quotes).
如果存在至少一个位于条带内部(不包括边界)的两条不同直线的交点,则输出 "Yes"(不含引号);否则输出 "No"(不含引号)。
输入输出样例
输入#1
4 1 2 1 2 1 0 0 1 0 2
输出#1
NO
输入#2
2 1 3 1 0 -1 3
输出#2
YES
输入#3
2 1 3 1 0 0 2
输出#3
YES
输入#4
2 1 3 1 0 0 3
输出#4
NO
说明/提示
In the first sample there are intersections located on the border of the strip, but there are no intersections located strictly inside it.

在第一个样例中,存在位于条带边界的交点,但不存在严格位于条带内部的交点。

输入解题思路,AI测评打分。不知道怎么写?