atcoder#ABC218D. [ABC218D] Rectangles
[ABC218D] Rectangles
Score : points
Problem Statement
We have distinct points on a two-dimensional plane, numbered . Point has the coordinates .
How many rectangles are there whose vertices are among the given points and whose edges are parallel to the - or -axis?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
6
0 0
0 1
1 0
1 1
2 0
2 1
3
There are three such rectangles:
the rectangle whose vertices are Points , , , ,
the rectangle whose vertices are Points , , , ,
and the rectangle whose vertices are Points , , , .
4
0 1
1 2
2 3
3 4
0
7
0 1
1 0
2 0
2 1
2 2
3 0
3 2
1