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

Правка en1, от 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?

Теги sortings, binary search

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский mahmoud_arafa 2016-09-09 23:00:01 522 Initial revision (published)