Problems with tag O(nlogr)