AIM Tech Round 3 (Div. 2) — Problem B

Revision en1, by mahmoud_arafa, 2016-09-09 23:00:01

Hello,

Can anyone help me with a tutorial for this problem?

I had an idea using binary search. We can sort the array, then each time we look for the next nearest point using binary search. After that we remove that point from the points list and then we look for the next nearest point and so on. But the drawback is the 'erase' step, which takes O(N) complexity. That changes overall complexity from O(N log N) to O(N * [log N + N]) which is O(N^2).

So any help here please?

Tags sortings, binary search

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English mahmoud_arafa 2016-09-09 23:00:01 522 Initial revision (published)