Help needed for SPOJ problem GANNHAT

Revision en1, by ka89, 2016-08-02 18:29:36

Hi all,

I am trying to solve a problem on SPOJ.

GANNHAT spoj

This is a problem about kd trees i think, but I havent been able to solve it. I searched forums and got a hint regarding how this can also be done using Fenwick trees, but I am still not able to get much insights.

N is large so algorithm does need to run in O(nlogn) or better. Can anyone please help me in this? Some lines on how this can be solved using BIT, or any suggestion you can share would be very helpful.

Thanks Anant

Tags data structures, fenwick tree

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ka89 2016-08-02 18:29:36 583 Initial revision (published)