Problem Brief
Do They Belong?
INTERNFULLTIMEOA
A triangle formed by the three points a(x1, y1), b(x2, y2) and c(x3, y3) is a non-degenerate triangle if the following rules are respected (|ab| is the length of the line between points a and b):
- |ab| + |bc| > |ac|
- |bc| + |ac| > |ab|
- |ab| + |ac| > |bc|
A point belongs to a triangle if it lies somewhere on or inside the triangle. Given two points p = (xp, yp) and q = (xq, yq), return the correct scenario number:
- 0: If the triangle abc does not form a valid non-degenerate triangle.
- 1: If point p belongs to the triangle but point q does not.
- 2: If point q belongs to the triangle but point p does not.
- 3: If both points p and q belong to the triangle.
- 4: If neither point p nor point q belong to the triangle.
Function Description
Complete the function pointsBelong in the editor below.
pointsBelong has the following parameter(s):
int x1, y1, x2, y2, x3, y3: integer coordinates of the three points that may create a valid triangleint xp, yp, xq, yq: integer coordinates of the two points p and q
Returns
int: an integer value that represents the scenario
1Example 1
Input
x1 = 0, y1 = 0, x2 = 2, y2 = 0, x3 = 4, y3 = 0, xp = 2, yp = 0, xq = 4, yq = 0
Output
0
Explanation

The lines do not form a valid non-degenerate triangle: The three points a, b, c lie on the same line, so it is impossible to form a triangle. The answer is 0.
Constraints
Limits and guarantees your solution can rely on.
0 ≤ x1, y1, x2, y2, x3, y3, xp, yp, xq, yq ≤ 2000