problem: LRQUR
my solution: here
Someone please tell why i am getting WA in 3 cases, please help…
hey nice implementation
corrected code : CodeChef: Practical coding for everyone
nothing wrong in your code the only thing you miss is that when (a[l] + a[r]) is odd you are considering only the left integer i.e. (a[l] + a[r])/2! consider the other one also and AC
You are getting out of index exception. Check increasing size of your seg tree array and see if any index number is going negative or not.
i have corrected it but again getting WA in 3 cases, plz check
u know if i use (int)((a[l] + a[r])/2.0 + .01), it is giving correct answer. thanks for your reply.