#P7058. [NWRRC2015] Kingdom Trip
[NWRRC2015] 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
题目大意
题目描述
很久以前,一位明智的国王统治着一个王国。在他长达43年的统治后,通过成功的军事行动和熟练的外交技巧,这个王国变成了一个无限的平面二维曲面。因为没有边界,这种方式大大地简化了王国的出行。
王国内准备举行一个盛大的节日。人们能聚集在个地点。因为国王想要近一点地看到他的子民,所以他下令去这些地点旅行。他想在每个地点演讲。起初他的旅行被计划成了一串多边形链:从到。
国王虽然很明智,但他也已经老了。因此,他的助手想出了一个方法来跳过部分地点,来确保国王演讲的次数能尽可能地少。旅程的新计划需要是一串由某个子序列所构成的多边形链:从到,正规的表示为:从到,且。国王的助手知道国王不会允许跳过地点,如果与到这一段的距离超过了,对于每个,。
输入
第一行,包含两个整数和,分别表示最初的路线的地点数和跳过地点被允许的距离的最大值(;)
接下来行,第行包含两个整数和,表示点的坐标。坐标的绝对值不超过。不会出现两个点重合的情况。
输出
输出国王经过的地点数量的最小值,答案保证在内;
时间限制:2秒,内存限制:256MB
5 2
2 6
8 2
14 2
12 9
13 8
3
提示
Time limit: 2 s, Memory limit: 256 MB.