report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Perpendicular pairs - FlandreOJ: Flandre 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 ```
Geometry
Three points
Line segment intersection
Line intersection
Quadrilateral classification
Point location
Triangle classification
Polygon area
Distance to polygon
Convex hull
Perpendicular pairs
Maximum quadrilateral
Catching butterflies
Topic
Geometry
Rating 1600
Solution (0) Solution