Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Language: A rectangle
Description 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. Input 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 Output should contain the number of ways children can make a rectangle. If there's no way, just output 0. Sample Input 6 2 3 0 0 2 0 2 3 0 3 4 0 4 3 Sample Output 2 Source |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator