[problem:DIVMAC]

Revision en1, by shubhinanugullu, 2017-11-08 23:52:51

[problem:DIVMAC] Please read this editorial for this problem on codechef.

Can some body please prove how the time complexity of the algorithm got reduced form O(Q N lgN) to O(N lgM lgN + Q lgN), where N is the size of the array, M is the bound on the elements of the array, and Q is the number of queries, by adding count_non_degenerate field to every node of the segment tree?

I have an intuition about the idea that we won't go into subtree rooted at node x if x has count_non_degenerate=0, which will reduce the time , but I cannot compute the exact time complexity quantitatively.

Tags #codechef, #editorial, segment tree, algorithm complexity

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English shubhinanugullu 2017-11-08 23:52:51 745 Initial revision (published)