Perpendicular pairs - MarisaOJ: Marisa Online Judge

Perpendicular pairs

Time limit: 1000 ms
Memory limit: 256 MB
Given $n$ lines, the $i^{th}$ one passes through two distinct points $A_i(x_1,y_2)$ and $B_i(x_2,y_2)$. Count the number of pairs $1 \le i < j \le n$ that line $i$ and $j$ are perpendicular. It is guaranteed that $A_i \neq B_i$. ### Input - The first lines contains an integer $n$. - The next $n$ lines, each line contains four integers $x_1,y_1,x_2,y_2$ describing a line. ### Output - Print the number of satisfied pairs. ### Constraints - $ 1 \le n \le 10^5$. - $-10^9 \le x, y \le 10^9$. ### Example Input: ``` 4 0 0 10 10 2 2 5 5 0 0 10 0 0 0 10 -10 ``` Output: ``` 2 ```