102662: [AtCoder]ABC266 C - Convex Quadrilateral

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:8 Solved:0

Description

Score : $300$ points

Problem Statement

Consider a two-dimensional coordinate plane, where the $x$-axis is oriented to the right, and the $y$-axis is oriented upward.

In this plane, there is a quadrilateral without self-intersection.
The coordinates of the four vertices are $(A_x,A_y)$, $(B_x,B_y)$, $(C_x,C_y)$, and $(D_x,D_y)$, in counter-clockwise order.

Determine whether this quadrilateral is convex.

Here, a quadrilateral is convex if and only if all four interior angles are less than $180$ degrees.

Constraints

  • $-100 \leq A_x,A_y,B_x,B_y,C_x,C_y,D_x,D_y \leq 100$
  • All values in input are integers.
  • The given four points are the four vertices of a quadrilateral in counter-clockwise order.
  • The quadrilateral formed by the given four points has no self-intersection and is non-degenerate. That is,
    • no two vertices are at the same coordinates;
    • no three vertices are colinear; and
    • no two edges that are not adjacent have a common point.

Input

Input is given from Standard Input in the following format:

$A_x$ $A_y$
$B_x$ $B_y$
$C_x$ $C_y$
$D_x$ $D_y$

Output

If the given quadrilateral is convex, print Yes; otherwise, print No.


Sample Input 1

0 0
1 0
1 1
0 1

Sample Output 1

Yes

The given quadrilateral is a square, whose four interior angles are all $90$ degrees. Thus, this quadrilateral is convex.

Figure


Sample Input 2

0 0
1 1
-1 0
1 -1

Sample Output 2

No

The angle $A$ is $270$ degrees. Thus, this quadrilateral is not convex.

Figure

Input

题意翻译

输入平面直角坐标系内四个点 $A,B,C,D$ 的坐标,判断四边形 $ABCD$ (四条边分别为 $AB,BC,CD,DA$)是否为凸四边形。 题目保证两组对边(指这两条线段)均不相交。

Output

分数:300分 部分 问题描述 考虑一个二维坐标平面,其中x轴朝右,y轴朝上。 在这个平面上,有一个没有自交的四边形。 四个顶点的坐标分别为$(A_x,A_y)$,$(B_x,B_y)$,$(C_x,C_y)$和$(D_x,D_y)$,按逆时针顺序排列。 判断这个四边形是否为凸的。 在这里,四边形只有当其四个内角都小于180度时才为凸的。 部分 约束条件 * $-100 \leq A_x,A_y,B_x,B_y,C_x,C_y,D_x,D_y \leq 100$ * 输入中的所有值都是整数。 * 给定的四个点是按逆时针顺序排列的四边形的四个顶点。 * 由给定的四个点形成的四边形没有自交且非退化。也就是说, * 没有任意两个顶点在相同的坐标上; * 没有任意三个顶点共线;以及 * 没有任意两个不相邻的边有公共点。 输入输出格式 输入格式 输入格式如下: ``` $A_x$ $A_y$ $B_x$ $B_y$ $C_x$ $C_y$ $D_x$ $D_y$ ``` 输出格式 如果给定的四边形为凸的,则输出`Yes`;否则,输出`No`。 样例 样例输入 1 ``` 0 0 1 0 1 1 0 1 ``` 样例输出 1 ``` Yes ``` 给定的四边形是一个正方形,其四个内角都是90度。因此,这个四边形是凸的。 样例图片 样例输入 2 ``` 0 0 1 1 -1 0 1 -1 ``` 样例输出 2 ``` No ``` 角A为270度。因此,这个四边形不是凸的。 样例图片

加入题单

上一题 下一题 算法标签: