Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 1.83 KB

File metadata and controls

40 lines (29 loc) · 1.83 KB

Gift Boxes

ITU ACM loves New Year's Eve and gifting each other, so they decided to hold a new year's raffle in 2023 as well. İrem and Hasan, on-again-off-again childhood friends, participated in the raffle in hopes of receiving lovely gifts from lovely people. But sadly, İrem drew a card with Hasan's name on from the pouch and now she has to buy a gift for a not-such-a-lovely person. Knowing she will eventually have to give him something, she wants to annoy him as much as possible.

She buys a gift in the shape of a prism of height $y$ and a square base with sides of length $x$. Her plot is to put this gift into as many boxes as possible. She wants to see Hasan's face turn red with anger as he takes out one box after another. To accomplish this, she visits a box store and needs your help to choose which boxes to buy. There are n boxes in the store and all of them are prisms with a square base.

To put the gift into a box, all side lengths of the box must be strictly larger than the gift. The same rule applies to every step of gift wrapping. Can you help İrem to put her gift into as many boxes as possible?

Note that İrem will not rotate boxes. She can use a box if and only if it has a larger base and a taller depth than the one she has at hand.

Input Format:

The first line consists of three integers $n$, $x$, $y$.

$n$ denotes the number of boxes in the store while $x$ is the length of the base side length and $y$ is the height of the gift.

The following $n$ lines contain two integers $l$, $d$ each: $l$ is the length of one edge of the square base and $d$ is the depth of the box.

Constraints:

  • 0 < $n$ < 5000
  • 0 < $x$ , $y$ < $10^6$
  • 0 < $l$ , $d$ < $10^6$

Output Format:

Print an integer denoting the number of boxes İrem should buy.

Sample Input:

5 3 3
4 4
5 6
6 5
8 6
9 9

Sample Output:

4