#P4165. Optimal NBA Draft Candidate Selection

    ID: 17413 Type: Default 1000ms 256MiB

Optimal NBA Draft Candidate Selection

Optimal NBA Draft Candidate Selection

In the NBA draft process, teams evaluate players based on their speed and height. Given a set of N players, each with a height and speed, along with three parameters A, B, and C, a potential candidate must satisfy a certain condition when being selected into a team.

Suppose that for a chosen subset of players the smallest height is \(\text{minH}\) and the smallest speed is \(\text{minV}\). Then every player in the team must satisfy the inequality:

[ A \times (\text{height} - \text{minH}) + B \times (\text{speed} - \text{minV}) \leq C ]

This condition ensures that the differences in speed and height among team members are not too large. As the team management, your task is to select as many candidates as possible such that there exists a choice of \(\text{minH}\) and \(\text{minV}\) based on one of the selected players (i.e. the one with the minimum height and minimum speed in the chosen subset) and every chosen candidate satisfies the above inequality.

More formally, if you choose a candidate \(i\) as the base (with height \(h_i\) and speed \(v_i\)), then any candidate \(j\) (with \(h_j\) and \(v_j\)) can be included in the team only if \(h_j \geq h_i\), \(v_j \geq v_i\), and

[ A \times (h_j - h_i) + B \times (v_j - v_i) \leq C. ]

Your goal is to select the maximum number of candidates from the given \(N\) candidates.

inputFormat

The input is given as follows:

  • The first line contains four integers N, A, B and C separated by spaces.
  • Then follow N lines, each containing two integers representing the height and the speed of a candidate.

It is guaranteed that all numbers are integers.

outputFormat

Output a single integer, the maximum number of candidates that can be selected such that the condition holds.

sample

4 1 1 5
1 2
2 3
3 5
6 6
3