Hello all
I'm trying to solve the problem http://www.spoj.com/problems/HORRIBLE/ but getting WA again n again. I'm using segment trees with lazy propagation. Can somebody please help figure out my mistake.
Thanks in advance.
Code: http://pastebin.com/aT3pvi3K
-- Thanks to diego_v1
It's in the memset call. You specified the number of elements of each array, when actually memset asks you for the SIZE of the array, which is number of elements * size of each element.
Change 4*MAX with 4*MAX*sizeof(ll) and you'll get accepted.