CF849B.Tell Your World

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

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, 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.

用直线连接无数个点,直到抵达遥远的彼方。

在坐标平面上有 nn 个点,其中第 ii 个点的坐标为 (i, yi)(i,\,y_i)。

判断是否可以画出两条平行且不重叠的直线,使得集合中的每个点恰好位于其中一条直线上,且每条直线至少经过集合中的一个点。

输入格式

The first line of input contains a positive integer n (3 ≤ n ≤ 1 000) — the number of points.

The second line contains n space-separated integers _y_1, _y_2, ..., y__n ( - 109 ≤ y__i ≤ 109) — the vertical coordinates of each point.

输入的第一行包含一个正整数 nn(3≤n≤1 0003 \leq n \leq 1\,000)—— 点的个数。

第二行包含 nn 个用空格分隔的整数 y1, y2, …, yny_1,\,y_2,\,\dots,\,y_n(−109≤yi≤109-10^9 \leq y_i \leq 10^9)—— 各点的纵坐标。

输出格式

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).

如果可以满足要求,则输出“Yes”(不带引号);否则输出“No”。

您可以以任意大小写(大写或小写)输出每个字母。

输入输出样例

  • 输入#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.

在第一个例子中,共有五个点:(1, 7)(1,\,7)、(2, 5)(2,\,5)、(3, 8)(3,\,8)、(4, 6)(4,\,6) 和 (5, 9)(5,\,9)。可以画出一条直线,使其经过第 11、33、55 号点;再画另一条直线,使其经过第 22、44 号点,并且与第一条直线平行。

在第二个例子中,虽然可以画出两条直线覆盖所有点,但它们无法做到互相平行。

在第三个例子中,无法同时满足这两个要求。

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

首页