A question for a enthusiast like me but from a difficult topic.......(MO's ALGORITHM)

Revision en2, by prabal_1997, 2018-05-22 20:16:24

question goes like this.... given an array of n nos.and queries q the queries follow like this given range l to r (l<=r) for every query we have to find sum of elements which have an odd frequency in the given range

note : 1 based indexing is followed.............................................................................................

example : 5......n

1 2 2 2 1....elements

3..queries...

1 3...

1 4......

1 5......

output: 1..... 7..... 6.....

explanation : 1. in range 1 to 3 only 1 has odd frequecy i.e 1 so ans =1 !!! 2.in range 1 to 4 1 has frequency 1 and 2 has frequecy 3 so ans = 1*1 + 2*3 = 6 !!!

I am not able to solve this......question if time limit is 1 second.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English prabal_1997 2018-05-22 20:16:24 168
en1 English prabal_1997 2018-05-22 20:11:13 653 Initial revision (published)