#P8370. Maximum Gold Mine Coverage

    ID: 21549 Type: Default 1000ms 256MiB

Maximum Gold Mine Coverage

Maximum Gold Mine Coverage

Byteman, one of the most dedicated employees at The Goldmine in Byteland, is about to retire. To honor his years of hard work, the management has decided to reward him with a rectangular piece of mining land. The rectangle has fixed dimensions \(s\) (length) and \(w\) (width) and its sides are aligned with the coordinate axes. Byteman is free to choose the location of his mining land.

The value of a piece of land is defined as the number of natural gold ore points contained within it. A gold ore is considered to be inside the land if it lies within the rectangle or on its boundary (i.e. in the interval \([x, x+s]\) in the horizontal direction and \([y, y+w]\) in the vertical direction, where \((x,y)\) is the bottom-left coordinate of the rectangle).

You are given the positions of \(n\) gold ore points and the dimensions \(s\) and \(w\) of the rectangle. Your task is to compute the maximum number of gold ore points that can be captured by optimally positioning the rectangle.

The entire mining area is assumed to be infinite, but only a finite set of coordinates contain gold ore.

inputFormat

The input consists of:

  • The first line contains three integers \(n\), \(s\) and \(w\), where \(n\) is the number of gold ore points, and \(s\) and \(w\) are the dimensions of the rectangular land.
  • The following \(n\) lines each contain two integers \(x\) and \(y\), representing the coordinates of a gold ore point.

You can assume that \(n\) is small enough so that a brute force solution is feasible.

outputFormat

Output a single integer: the maximum number of gold ore points that can be covered by a rectangle of size \(s\) by \(w\) when it is optimally positioned.

sample

4 2 3
1 1
2 2
3 3
4 4
3