For each pair of points, consider the family of lines parallel to the line that connects the points. Project all the points on the line perpendicular to the family, sort the coordinate, and find the smallest coordinate distance that covers k points. Note that since at least one line on the border must contain two points, instead of sorting one can use partition and nth_element. That is the time complexity does not need logarithm: O(n^3). Test 16 contains the special case, where n = k = 1. The answer is obviously 0.000000. I don't understand why the author has put this special case on test 16, I didn't ever think, that it could be a special case. It rather costs me lots of time to debug. ... then maybe you misread the statement: 1. Pins have diameter 1, not 0 2. You should output diameter of the ball, not radius Thank you! And it's really interesting that you know exactly how stupid I am. Edited by author 28.11.2014 22:25 Edit: Found it, just print out the solution as fixed. E.g. cout<<fixed<<solution; Edited by author 19.04.2011 05:59 I have WA 4. Can somebody give me a hint about what's in this test case? Can I get any hint on how test 21 looks like, I'm going crazy with WA on that one... I've got the same problem. :( Edited by author 16.04.2011 04:33 Edited by author 16.04.2011 02:31 Can someone explain sample test? How come output is 1.00000000, when there is a pin at (3,0)? You don't have to hit all the pins, only k of them. In this example k is 4, and you hit all the pins except (3, 0). Im using the most stupid algo n^4 With special case m<=2 What`s the trick? Any hints on how to solve this problem?? Edited by author 09.04.2011 01:59 it seems easy :) Edited by author 09.04.2011 02:20 Which algo to solve this problem?? Any hints plz In the final loop, when you count the number of circles which the given line touches, use only + and * operations (without divisions and  OMG  square roots)  this will speed your code up several times. Edited by author 13.10.2010 21:13 Throught what set of lines should i iterate?? Help pls I wrote a solution with complexity of O(n^3 log n) and got AC for 0.75 sec. Is there a solution for O(n^3) or O(n^2 log n)? I have O ( N ^ 3 * LogN )and got AC for 0.234s, you can just optimize it. I can't think of a solution with better complexity. Have u used stabbing line problem variation? What algo have u used to solve this problem Can anyone help me, I got WA on test 2 and don't understand why? I got WA2 too...why?? Try this Test: 1 1 100 100 is the result 0.000000000 right? Edited by author 09.10.2010 14:34 
