FLIPCOIN - seg tree

can anyone tell me why my code is giving me WA in codechef while passing the test case’s,
i’ve just learn seg tree and lazy propogation and the code seem fine to me
I am trying this question over a week
thanks in advance

https://www.codechef.com/viewsolution/13205344

I found something fishy on line 39 in this

1 Like

@ashwanigautam Thanks man you really made my day, Rookie mistake

DO NOT take segment tree size as 3 times the base array, it can lead to SIGSEGV error, test cases are weak in the problem. Use correct upper bound which is 4 times the size of the array, if you want to save space, google tighter upper bound on size of segment tree for N length base array

//