http://www.codechef.com/viewsolution/3492819 …pls temme wat is my mistake…thanks

The only problem which I find with the code is that the sum of values of all the marbles in a range can exceed the integer range at any time as there are 10^6 numbers and each number is 2000, so maximum sum is 2*10^9. But there are numerous queries where you could increment the values and hence the sum. So take the datatype of sum of range as long long int. Rest of the code seems to be fine.

1 Like

got AC…thanks bro

Your welcome!