CF849B.Tell Your World
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Connect the countless points with lines, till we reach the faraway yonder.
There are n points on a coordinate plane, the i -th of which being (i,yi) .
Determine whether it's possible to draw two parallel and non-overlapping lines, such that every point in the set lies on exactly one of them, and each of them passes through at least one point in the set.
输入格式
The first line of input contains a positive integer n ( 3<=n<=1000 ) — the number of points.
The second line contains n space-separated integers y1,y2,...,yn ( −109<=yi<=109 ) — the vertical coordinates of each point.
输出格式
Output "Yes" (without quotes) if it's possible to fulfill the requirements, and "No" otherwise.
You can print each letter in any case (upper or lower).
输入输出样例
输入#1
5 7 5 8 6 9
输出#1
Yes
输入#2
5 -1 -2 0 0 -5
输出#2
No
输入#3
5 5 4 3 2 1
输出#3
No
输入#4
5 1000000000 0 0 0 0
输出#4
Yes
说明/提示
In the first example, there are five points: (1,7) , (2,5) , (3,8) , (4,6) and (5,9) . It's possible to draw a line that passes through points 1,3,5 , and another one that passes through points 2,4 and is parallel to the first one.
In the second example, while it's possible to draw two lines that cover all points, they cannot be made parallel.
In the third example, it's impossible to satisfy both requirements at the same time.