imaxblue has completed his mission, but he realizes he has much more events to alter. There are
key points in space-time, numbered
to
, conveniently represented by positive points on the coordinate grid. imaxblue has
events he would like to change, also represented by points in space-time (note that these are not necessarily key points). However, changing a point will affect all points contained within the square of that point and the origin
. Formally, changing point
will affect all points
with
and
for
between
and
. imaxblue would like to make sure that no key point is affected by more than
changed event. Help imaxblue find the largest number of key points he can change, without changing any key point twice.
Subtasks
For all cases:
.
For 3 points,
.
For additional 2 points,
.
Sample Input
Copy
5 5
1 5
2 4
3 2
8 2
5 3
8 2
6 3
1 10
2 4
100 1
Sample Output
Copy
4
Explanation
Change points
,
and
to affect points
,
,
and
.
Comments