Submit | All submissions | Best solutions | Back to list |
CEOI09PH - CEOI09 Photo |
You are given a photo of the skyline of Târgu-Mures taken during the night. Some rooms still have the light on. You know that all the buildings can be modeled by rectangles of surface area at most A. Find the minimum number of buildings that can lead to the picture.
Specifically, you are given an integer A, and N points at integer coordinates (x,y). You must find a minimum number of rectangles that have one side on the x-axis and area at most A, which cover all points. The rectangles may overlap.
Input
The first line of the standard input will contain two integers N and A, separated by a single space. The next N lines will contain two integers x and y, representing the coordinates of each point.
Output
To the standard output write exactly one line containing the minimum number of rectangles.
Example
Input:
6 4
2 1
4 1
5 1
5 4
7 1
6 4
Output:
3
Constraints
· 1 ≤ N ≤ 100
· 1 ≤ A ≤ 200 000
· Each point has 0 ≤ x ≤ 3 000 000 and 1 ≤ y ≤ A
Added by: | Ivan Katanic |
Date: | 2009-08-18 |
Time limit: | 0.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 SCM qobi VB.NET |
Resource: | CEOI 2009 - Romania |