当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
There are four active children, whose names are Her-ri, Sumyou, Dashom, and Hooyeon, respectively. They play with N distinct points on the x-y coordinates. Each of them chooses a point, and they want to make a rectangle, with 4 points they choose, whose sides are parallel to either x-axis or y-axis. Also, a rectangle should have A width and B height. 4 children are really eager to know how many ways they can build up a rectangle. For example, if there are 6 points whose pairs are (0, 0), (5, 0), (5, 10), (7, 10), (7, 0) and (0, 10) and children want to make a rectangle whose width is 5 and height is 10, there is just one way to make it.
The first line of input will be a positive integer, N (5 ≤ N ≤ 500,000), which indicates the number of points on the coordinates. The second line contains two positive integers A and B (A, B ≤ 1,000,000,000), which should be the width and height of the rectangle, respectively. The i-th line of next N lines will contain xi and yi (−1,000,000,000 ≤ xi, yi, ≤ 1,000,000,000), which represent the i-th point.
Output should contain the number of ways children can make a rectangle. If there's no way, just output 0.
6 2 3 0 0 2 0 2 3 0 3 4 0 4 3
2
Case time limit(单组数据时间限制) | 1000MS |
时间上限 | 内存上限 |
7000 | 65536 |