#P5975. Minimum Rectangle Cover with Fixed Base on X-Axis

    ID: 19200 Type: Default 1000ms 256MiB

Minimum Rectangle Cover with Fixed Base on X-Axis

Minimum Rectangle Cover with Fixed Base on X-Axis

Given n points on the plane and a positive number A, cover all points using the minimum number of rectangles whose bottom side lies on the X-axis and whose area is less than or equal to A. The rectangles may overlap and their vertices are not required to have integer coordinates.

A rectangle in this problem is defined by its bottom edge on the X-axis, and a top horizontal edge at y = H (with H ≥ yi for every point (xi, yi) that it covers). If the rectangle covers points with minimum x-coordinate xmin and maximum x-coordinate xmax and the maximum y-value among the covered points is H, then the rectangle must satisfy

(xmaxxmin)×HA.(x_{max} - x_{min}) \times H \le A.

It can be shown that an optimal solution consists of partitioning the points (sorted by their x-coordinate) into contiguous segments, each segment covered by one rectangle satisfying the area constraint. Your task is to compute the minimum number of such rectangles needed to cover all points.

inputFormat

The first line contains two numbers n and A (n is the number of points, and A is the maximum allowed area for each rectangle).

Each of the following n lines contains two numbers x and y representing the coordinates of a point.

outputFormat

Output a single integer representing the minimum number of rectangles required to cover all the points such that each rectangle has its bottom side on the X-axis and an area less than or equal to A.

sample

3 10
1 2
3 1
6 2
1