Number of distinct elements in a subarray(solving online)

Revision en2, by Code_sprinter, 2020-06-11 07:49:33

hello everyone,

Recently i came across this problem http://www.spoj.com/problems/DQUERY/en/. I solved the problem using Mo's algo and BST which is basically offline solution. Is there a way I can solve for each query online (and similarly for trees that involves queries on the subtree of its nodes)? If yes, please help me out.

Thanks in advance!!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Code_sprinter 2020-06-11 07:49:33 91
en1 English Code_sprinter 2020-06-11 07:47:22 344 Initial revision (published)