deam0n's blog

By deam0n, 12 years ago, In English

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

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
12 years ago, # |
  Vote: I like it +3 Vote: I do not like it

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.