aliassadi's blog

By aliassadi, history, 5 years ago, In English

Hi.
I want to solve a problem. There is n points upper than x = 0 (not on x = 0). We can put circles with radius r on x axis (Which mean their center lie on x axis). We must use minimum circles to cover all points. a point is covered if lie on a circle or be inside a circle. in input n and n points and r is given.
Example:
Input:

3 2   // 3 point and r = 2    
1 2   // point 1    
-3 1  // point 2    
2 1   // point 3  

output:

2   

This is problem. We have one second time limit and we can not do lots of working.
I do a greedy approach. I start from most left. I choose from most left and choose a circle. my point should lie on that circle. I think this is best answer. then skip all point which covered with that circle and do it again until finish all point.
However I get wrong answer. I think a lot and I found some problem. I couldn't find a better way.
Is it possible to help me? I think that I can map this problem to a famous algorithm but I couldn't find it!!!
I'm sorry for bad English too. Thanks.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it