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ā€¦