#D. C - Convex Quadrilateral

    传统题 1000ms 256MiB

C - Convex Quadrilateral

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

C - Convex Quadrilateral

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:

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.


0 0
1 0
1 1
0 1
Yes

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

Figure


0 0
1 1
-1 0
1 -1
No

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

Figure

2024暑假入门组刷题营第三期(四)

未参加
状态
已结束
规则
IOI
题目
8
开始于
2024-7-11 13:00
结束于
2024-7-11 15:00
持续时间
2 小时
主持人
参赛人数
8