#abc218d. D - Rectangles
D - Rectangles
Score : points
问题描述
我们有 个不同的点在二维平面上,编号为 。第 个点 的坐标为 。
有多少个矩形的顶点是给定的这些点,并且其边与 -轴或 -轴平行?
以上为通义千问 qwen-max 翻译,仅供参考。
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.
Sample Input 1
6
0 0
0 1
1 0
1 1
2 0
2 1
Sample Output 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 , , , .
Sample Input 2
4
0 1
1 2
2 3
3 4
Sample Output 2
0
Sample Input 3
7
0 1
1 0
2 0
2 1
2 2
3 0
3 2
Sample Output 3
1
update @ 2024/3/10 09:38:50