Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
Statistical Charts
Submit Problem
Online Status
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
A rectangle
Time Limit: 7000MSMemory Limit: 65536K
Total Submissions: 2281Accepted: 545
Case Time Limit: 1000MS


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.

Sample Input

2 3
0 0
2 0
2 3
0 3
4 0
4 3

Sample Output



[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator