
James Bond 
Time Limit: 10000ms, Special Time Limit:25000ms, Memory Limit:32768KB 
Total submit users: 17, Accepted users: 6 
Problem 10013 :
No special judgement

Problem description 
This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of drug dealers. He was sent to a small piece of land at the center of a lake filled with crocodiles. There he performed the most daring action to escape  he jumped onto the head of the closeby crocodile! Before the animal realized what was happening, James jumped again onto the next big head... Finally he reached the bank before the last crocodile could bite him (actually the stunt man was caught by the big mouth and barely escaped with his extra thick boot).
Assume that the lake is a 1000 กม 1000 square one. Assume that the center of the lake is at (0,0) and the northeast corner at (500,500). The central island is a disk centered at (0,0) with the radius of 15. A number of crocodiles are in the lake at various positions. Given the coordinates of each crocodile and the distance that James could jump, you must tell him a shortest path to reach one of the banks. The length of a path is the number of jumps that James has to make.

Input 
The input file consists of several test cases. Each case starts with a line containing two integers n <= 1000, the number of crocodiles, and d > 0, the distance that James could jump. Then one line follows for each crocodile, containing the ( x , y ) location of the crocodile. Note that x and y are both integers, and no two crocodiles are staying at the same position. The input is finished by a negative number.

Output 
For each test case, if James can escape, output to a file in one line the minimum number of jumps he must make. Then starting from the next line, output the position ( x , y ) of each crocodile on the path, each pair in one line, from the island to the bank. If it is impossible for James to escape that way, simply give him 1 as the number of jumps. If there are many shortest paths, just output any one of them.

Sample Input 
5 100
100 0
170 0
270 0
370 0
450 0
1 10
20 30
1 
Sample Output 
6
100 0
170 0
270 0
370 0
450 0
1 
Problem Source 
HNU Contest

Submit
Discuss
Judge Status
Problems
Ranklist

