Master_coder's blog

By Master_coder, history, 9 months ago, In English,

how to do this problem with segment tree data structure. https://www.codechef.com/SEPT17/problems/SEACO

 
 
 
 
  • Vote: I like it  
  • +1
  • Vote: I do not like it  

»
9 months ago, # |
Rev. 5   Vote: I like it 0 Vote: I do not like it

First of all, you need to count how many times a command will be executed. It can done by starting with higher index and work only for type 2.

Secondly, for each command of type 1 perform this command previously calculated times.

Sorry for my bad English.

»
9 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Almost Same Problem: 295A - Егор и массив

»
9 months ago, # |
  Vote: I like it 0 Vote: I do not like it

anyone done using bit/fenwick tree ?

»
9 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I think it could be solved using prefix sums :D