How to solve spoj SALMAN?

@l_returns

Did you get time to check it?

well I did found that you haven’t printed ā€œCase 1:ā€ thing before printing the answer… which is the same mistake I did… and ur code give 0 for second output in the given test case… so I ll look into it and get back to u…

one more thing to ask… have you cleared all arrays after each test case ??
because specially lazy tree should be initialized 0 for each test case…

what I noticed was there is some error with inputs… the ā€œvā€ for 3rd query is getting wrong… after that I would like to point out the way you called update function…
update(1, 0, n - 1, s[v], e[v], x);
why it is 0 to n-1
I mean I am not saying that it is wrong but all other queries had input 1 to n and only this had 0 to n-1…
so just check that…
moreover take long instead of int cuz I saw some comments on que that many wrong submissions for overflow…
make arrays new before/after each test case… I mean make lazy tree 0
, clear the ā€œLISTā€
tell me after doing this much changes…