luogu#P4165. [SCOI2007] 组队

[SCOI2007] 组队

Problem 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 minVminV and the shortest player’s height is minHminH. Then all players on this team should satisfy: A×(heightminH)+B×(speedminV)CA\times(height-minH)+B\times( speed-minV)\le C, where A,B,CA, 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 NN 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,CN, A, B, C. Then NN lines follow; each line contains two integers describing one player’s heightheight and speedspeed.

Output Format

Output the maximum number of candidate players.

4 1 2 10
5 1
3 2
2 3
2 1
4

Hint

Constraints: N5000N \le 5000, height,speed10000height, speed \le 10000; A,B,CA, B, C fit in a long integer.

Translated by ChatGPT 5