#P2665. Drawing Non-Parallel Lines
Drawing Non-Parallel Lines
Drawing Non-Parallel Lines
Farmer John has challenged Bessie to the following game. Farmer John provides a board with N distinct lattice points, where the i-th point has coordinates \(X_i\) and \(Y_i\) satisfying \(-1000 \le X_i \le 1000\) and \(-1000 \le Y_i \le 1000\). Bessie can score a point by drawing a straight line between any two distinct points if and only if there is no line (already drawn) parallel to this new line. At the end of the game, her score is equal to the number of lines drawn.
Your task is to help Bessie by computing the maximum number of lines she can draw. In other words, you need to count the number of distinct slopes between any two points. Note that a vertical line (where \(X_i = X_j\)) is considered to have a unique slope.
Note: Two lines are parallel if they have identical slopes. For non vertical lines, the line through points \((X_i, Y_i)\) and \((X_j, Y_j)\) has slope \(\frac{Y_j - Y_i}{X_j - X_i}\) (in \(\latex\) format). Vertical lines should be treated as having the same unique slope.
inputFormat
The first line contains an integer \(N\) (\(2 \le N \le 200\)), the number of points on the board. Each of the following \(N\) lines contains two integers \(X_i\) and \(Y_i\) (\(-1000 \le X_i, Y_i \le 1000\)) representing the coordinates of the \(i\)-th point. All points are guaranteed to be distinct.
outputFormat
Output a single integer: the maximum number of lines Bessie can draw. This number is equal to the total count of distinct slopes formed by all pairs of points.
sample
2
0 0
1 1
1