Best Cover

Revision en8, by aliassadi, 2019-03-22 22:34:11

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.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en8 English aliassadi 2019-03-22 22:34:11 35 Tiny change: 'ind it!!! \nThanks. ' -> 'ind it!!! \nI'm sorry for bad English too.\nThanks. '
en7 English aliassadi 2019-03-22 22:33:37 11 Tiny change: '. We have time limi' -> '. We have one second time limi'
en6 English aliassadi 2019-03-22 22:33:05 1 Tiny change: ' point and1 r = 2 ' -> ' point and r = 2 '
en5 English aliassadi 2019-03-22 22:32:50 40
en4 English aliassadi 2019-03-22 22:32:30 146
en3 English aliassadi 2019-03-22 22:27:45 2
en2 English aliassadi 2019-03-22 22:25:23 45
en1 English aliassadi 2019-03-22 20:22:17 852 Initial revision (published)