#K52527. Valid Constellation
Valid Constellation
Valid Constellation
You are given a set of points in the plane. Determine if these points can form a valid constellation where no three points lie on the same straight line. In other words, check if there is no collinearity among any triplet of points.
Input: The input consists of multiple test cases. Each test case begins with an integer N denoting the number of points followed by N lines each containing two integers representing the coordinates of a point.
Output: For each test case, output "YES" if the points form a valid constellation (no three collinear), otherwise output "NO".
Note: A set of points is considered invalid if there exists any three points which are collinear. The condition for collinearity of three points \( (x_1,y_1), (x_2,y_2), (x_3,y_3) \) can be expressed in LaTeX as:
\[ (x_2 - x_1)(y_3 - y_1) = (y_2 - y_1)(x_3 - x_1) \]
Read the input from standard input (stdin) and output the result to standard output (stdout).
inputFormat
The first line contains an integer T, the number of test cases. For each test case:
- The first line contains an integer N, the number of points.
- The next N lines each contain two integers \(x\) and \(y\) representing the coordinates of a point.
All input is provided via standard input.
outputFormat
For each test case, print a single line containing either "YES" (if the points form a valid constellation with no three collinear) or "NO" (if they do not).
All output should be written to standard output.
## sample2
4
1 1
2 2
3 3
4 4
5
0 0
1 2
2 3
3 1
4 4
NO
YES
</p>