Problem E
Antimatter Ray clearcutting
Input:standard Input
Output:standard Output
It ' s year 2465, and your are the chief Engineer for Glorified Lumberjacks Inc. on planet. There is a number of trees this you need to cut down and the only weapon you have are a high-powered antimatter ray that W Ill cut through trees like butter. Fuel cells for the antimatter ray are very expensive, so your strategy is:stand somewhere in the forest and shoot the Ray In some chosen direction. This'll cut down all of the trees that lie on the line in that direction. Given the locations of several trees and the number of trees that's are required to cut, what is the minimum number of s Hots that you need to fire?
Input
The "a" of input gives the number of cases, N (at most 20). N test Cases follow. Each one starts with 2 lines containing the integers n (the number of trees in the forest, at most) and M (The number O F trees you need to cut and at most N). The next n lines would each give the (x,y) coordinates of a tree (integers in the range [-1000, 1000]).
Output
For each test case, output the ' line ' case #x: ', where x is the number of the ' test case. On the "Next line", print the number of antimatter ray shots required to cut down at least m trees. Print an empty line between test cases.
Sample input Output for sample input
Notes
In the ' The ' the ' the ' the ' the ' the ' the ' can cut down 4 trees by standing at (0,-1) and firing north (cutting 2 trees) and then Standi Ng at (1,-1) and again firing north (cutting 2 trees).
In the second test case, you are should stand at (3,-1) and fire North (cutting 4 trees) and then stand at ( -1,-1) and Fire n Orth-east (cutting 3 more trees).