405260: GYM101858 L Luffy's Route

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

L. Luffy's Routetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Your pirate crew entered the Grand Line, Yahoo!!!

The Grand Line consists of $$$n$$$ islands, each located at some $$$(x_i, y_i)$$$. The Reverse Mountain, the start of the Grand Line, is located at position $$$(0, 0)$$$ and you want to enter the New World, which is located at $$$(l, 0)$$$. All islands on Grand Line are located between the Calm Belts which are located at $$$y = -1000$$$ and $$$y = 1000$$$.

You navigate the Grand Line using the Exp Pose (The Log Pose is out-dated, nobody uses it nowadays). The Exp Pose is a multi-compass that points to all islands located at $$$(x_j, y_j)$$$ if you are located at island located at $$$(x_i, y_i)$$$ which $$$\lvert x_i - x_j \lvert + \lvert y_i - y_j \lvert \le 5$$$ and $$$x_i < x_j$$$. Exp Pose also points to New World entrance, if all conditions apply. It's too dangerous to sail freely, thus your crew will always navigate only to islands that the Exp Pose is pointing to.

Your crew is very strong and fearless. To enjoy the most of the Grand Line you decided to visit as many islands as possible before entering the New World. What is the maximum number of islands your crew can visit?

Input

The first line of input consists of two integers, $$$n$$$ and $$$l$$$ ($$$0 \le n \le 10^5$$$, $$$1 \le l \le 10^5$$$) — the number of islands and the location of the New World entrance.

The next $$$n$$$ lines contains, each, two integers, $$$x_i$$$ and $$$y_i$$$ ($$$0 < x < l$$$, $$$-1000 \le y_i \le 1000$$$) — the location of the $$$i$$$-th island.

It's guaranteed that no two islands are located at the same position.

It's guaranteed that there's always at least one path from the Reverse Mountain to the New World entrance using the Exp Pose.

Output

Print the maximum number of islands your crew can visit between the Reverse Mountain and the New World entrance.

ExamplesInput
2 5
1 1
4 1
Output
2
Input
5 10
2 -2
3 3
5 0
6 0
8 3
Output
4

Source/Category

加入题单

算法标签: