i am getting wrong answer for this…my test cases work perfectly…i used segmented tree concept…its been 3 days i am behind the same problem…pls help…thanks
my solution is here http://www.codechef.com/viewsolution/3443852
i am getting wrong answer for this…my test cases work perfectly…i used segmented tree concept…its been 3 days i am behind the same problem…pls help…thanks
my solution is here http://www.codechef.com/viewsolution/3443852
Hi Chaseme, You should check out the editorial for the problem, it will help you get over your doubt. You can check the editorial here: http://discuss.codechef.com/questions/32149/marblegf-editorial
@ admin…i have read the editorial…i want to know what is wrong in ma code…i have seen solutions wer coders used segmentation tree to solve this problem…
@ chaseme
I saw your code. Change int segtree[] to long long segtree[]
Reason:
There can be atmost 10^6 numbers in array. and in each element is 2000 at max. So sum of given range can go upto 2*10^9 and it exceeds the integer range!
Hope this should help!
PS: change all the arguments in functions also to long long!
and There may be some other errors. But Iam sure this is one among them.Good luck!
thanks…