You are given a 2D plane containing \(N\) distinct integral points in the form of \((X,Y)\). Now a line segment is drawn between each pair of points. Your task is to determine the number of unordered pairs of these line segments that are orthogonal to each other.
Input format
- First line: \(N\)
- Next \(N\) lines: Two space-separated integers \(X\) and \(Y\) denoting a point on the plane
Output format
Print a single integer that represents the number of quadruples as described in the problem statement
Constraints
\(1 \le N \le 2*10^3\)
\(-2*10^3 \le X,Y \le 2*10^3\)
Subtasks
- For 20 points: \(1 \le N \le 100\)
- For 80 points: Implement the original constraints
5 1 1 2 2 0 0 1 -1 -1 1
10
Let the points be labelled \(P_1, P_2, P_3, P_4, P_5\) respectively according to the order in the sample input. One of the possible quadruple is \(P_2, P_3, P_4, P_5 \) because the angle between the line segments \(P_2, P_3\) and \(P_4, P_5\) is \(90^o\). There are \(9\) more such quadruples. Hence the answer to this sample case is \(10\).
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor