problem link:https://www.codechef.com/problems/MSTICK solution link:https://www.codechef.com/viewsolution/16520062 asked 09 Dec '17, 16:40

It is a basic segment tree problem with an insight. answered 09 Dec '17, 16:58
this is exactly what I have done. it would be helpful if you could point out the mistake in my code
(09 Dec '17, 17:01)
i guess you should use ceil function for ceil( (max(L,R)  min(L,R))/2)
(09 Dec '17, 17:04)
http://www.geeksforgeeks.org/minmaxrangequeriesarray/ Also, refer this implementation of Segment tree for minmax queries
(09 Dec '17, 17:06)
but i did max((max(l,r)+min(l,r))/2,min(l,r)+max( max(0, L1), max(R+1, N1))) which is basically the same thing and hence does not require ceil function
(09 Dec '17, 17:21)
Wait.. I'm solving it myself..
(09 Dec '17, 17:27)
it would be nice if u could point out error in my code,instead of solving it your self:)
(09 Dec '17, 17:48)
Your segment tree is working fine..
(09 Dec '17, 17:54)
Can't figure out what's wrong with your code... :( My code with same approach gives AC
(09 Dec '17, 18:07)
thanks for your help.. found the solution to my problem
(09 Dec '17, 20:07)
No problem. Although @vijju123 is the one to be thanked.
(09 Dec '17, 22:07)
showing 5 of 10
show all
