#P7058. [NWRRC 2015] Kingdom Trip
[NWRRC 2015] Kingdom Trip
题目描述
Once upon a time, there was a kingdom ruled by a wise king. After forty three years of his reign, by means of successful military actions and skillful diplomacy, the kingdom became an infinite flat two-dimensional surface. This form of the kingdom greatly simplified travelling, as there were no borders.
A big holiday was planned in the kingdom. There were locations for people to gather. As the king wanted to have a closer look at his people, he ordered to make a trip through these locations. He wanted to give a speech in each of these locations. Initially his trip was designed as a polygonal chain : . . .
Not only the king was wise, but he was old, too. Therefore, his assistants came up with an idea to skip some locations, to make the king to give as few speeches as possible. The new plan of the trip has to be a polygonal chain consisting of some subsequence of : starting at and ending at formally, where . Assistants know that the king wouldn't allow to skip location , if the distance from to segment exceeds , for such , that

Original route

New route
Help the assistants to find the new route that contains the minimum possible number of locations.
输入格式
The first line of the input file contains two integers and -- the number of locations in the initial plan of the trip and the maximum allowed distance to skipped locations ;
The following lines describe the trip. The i-th of these lines contains two integers and -- coordinates of point The absolute value of coordinates does not exceed No two points coincide.
输出格式
Output the minimum number of locations the king will visit. It is guaranteed that the answer is the same for
5 2
2 6
8 2
14 2
12 9
13 8
3
提示
Time limit: 2 s, Memory limit: 256 MB.