O(nlogk), use priority_queue to do this,

  1. create a max heap
  2. if(heap.size() < K or heap.top() > cur_dis), then update new data.