Convex Quadrilateral

AtCoder
IDabc266_c
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
0 0
1 0
1 1
0 1
Output #1
Yes

The given quadrilateral is a square, whose four interior angles are all $90$ degrees. Thus, this quadrilateral is convex.
![image](https://img.atcoder.jp/abc266/cda66d9b9f4291781d1ce47f59f29ab0.png)
Input #2
0 0
1 1
-1 0
1 -1
Output #2
No

The angle $A$ is $270$ degrees. Thus, this quadrilateral is not convex.
![image](https://img.atcoder.jp/abc266/2927f9f67e2cb7c35aeab05269b6fcc2.png)
API Response (JSON)
{
  "problem": {
    "name": "Convex Quadrilateral",
    "description": {
      "content": "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.   Th",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc266_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Consider a two-dimensional coordinate plane, where the $x$\\-axis is oriented to the right, and the $y$\\-axis is oriented upward.\nIn this plane, there is a quadrilateral without self-intersection.  \nTh...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments