Getting wrong answer in marblegef.

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

1 Like

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:

@ 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[]
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! :slight_smile:
Hope this should help!

PS: change all the arguments in functions also to long long! :slight_smile:
and There may be some other errors. But Iam sure this is one among them.Good luck! :slight_smile:

1 Like