Problems > Three in a Line

Three in a Line

Difficulty: 1000 2000 ms 128 MB

math geometry

Do the three points lie on one straight line?

Input: one line with six integers: x1 y1 x2 y2 x3 y3.

Output: YES or NO.

Constraints:

  • |coordinates| ≤ 109

Sample Tests

Input 1
0 0 1 1 2 2
Output 1
YES
Input 2
0 0 1 0 0 1
Output 2
NO

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.