A11080 | Tell Your World
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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,y_{i})$ .
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.
There are $n$ points on a coordinate plane, the $i$ -th of which being $(i,y_{i})$ .
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 $y_{1},y_{2},...,y_{n}$ ( $-10^{9}<=y_{i}<=10^{9}$ ) — the vertical coordinates of each point.
The second line contains $n$ space-separated integers $y_{1},y_{2},...,y_{n}$ ( $-10^{9}<=y_{i}<=10^{9}$ ) — 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).
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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted