P4165 [SCOI2007] Team Formation

Description

The NBA holds a player draft every year. A basketball player’s basic ability is usually measured by two pieces of data: speed and height. Suppose in a team, the slowest player’s speed is $minV$ and the shortest player’s height is $minH$. Then all players on this team should satisfy: $A\times(height-minH)+B\times( speed-minV)\le C$, where $A, B, C$ are given empirical values. This formula is easy to understand: if the players in a team differ too much in speed and height, it will cause poor coordination. As the team management, among $N$ draft players, what is the maximum number of candidate players that meet the condition?

Input Format

The first line contains four integers $N, A, B, C$. Then $N$ lines follow; each line contains two integers describing one player’s $height$ and $speed$.

Output Format

Output the maximum number of candidate players.

Explanation/Hint

Constraints: $N \le 5000$, $height, speed \le 10000$; $A, B, C$ fit in a long integer. Translated by ChatGPT 5