#abc266c. C - Convex Quadrilateral

C - Convex Quadrilateral

Score : 300300 points

问题陈述

在二维坐标平面上,其中xx轴朝右方向,yy轴朝上方向。

在此平面内,有一个不自相交的四边形。其四个顶点的坐标按照逆时针顺序分别为 (Ax,Ay)(A_x,A_y), (Bx,By)(B_x,B_y), (Cx,Cy)(C_x,C_y), 以及 (Dx,Dy)(D_x,D_y)

确定这个四边形是否为凸四边形。

这里,一个四边形是凸四边形当且仅当它的四个内角均小于 180180 度。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

Consider a two-dimensional coordinate plane, where the xx-axis is oriented to the right, and the yy-axis is oriented upward.

In this plane, there is a quadrilateral without self-intersection.
The coordinates of the four vertices are (Ax,Ay)(A_x,A_y), (Bx,By)(B_x,B_y), (Cx,Cy)(C_x,C_y), and (Dx,Dy)(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 180180 degrees.

Constraints

  • 100Ax,Ay,Bx,By,Cx,Cy,Dx,Dy100-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:

AxA_x AyA_y

BxB_x ByB_y

CxC_x CyC_y

DxD_x DyD_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 9090 degrees. Thus, this quadrilateral is convex.

Figure

Sample Input 2

0 0
1 1
-1 0
1 -1

Sample Output 2

No

The angle AA is 270270 degrees. Thus, this quadrilateral is not convex.

Figure

update @ 2024/3/10 11:14:34