Need help on 438D — The Child and Sequence

Revision en1, by xuanquang1999, 2015-08-05 12:03:27

I'm trying to solve Div1D on Codeforces Round 250 — The Child and Sequence. My idea is the same with the editorial: Build the maximum and sum segment tree, and for queries of type 2, I keep finding the largest number in the segment, mod it by x until there's no number in the segment larger or equal x. (All is done by segment tree). However, I got TLE on test 4.

My submission: 12348730

I can't find anything wrong with my solution, so that's why I need help on this. Can anyone help me with this? Thanks in advanced.

Tags help me

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English xuanquang1999 2015-08-05 12:03:27 633 Initial revision (published)