Mixtures spoj - Why cummulative sum is taken

In the question we can only take two mixtures at a particular state why we are taking sum of all mixtures from i to k and k+1 to j.And not taking the multiplication of two buckets.

Hey @asknishant.39
f(i,j) = f(i,k) + f(k+1,j) + csum(i,k)*csum(k+1,j)

See here
Assume
A B C D E
was combined by Harry and finally we have X Y left here X is (A+B+C)%100 and Y is (D+E)%100

Now we combine X & Y we get XY => (A+B+C)%100*(D+E)%100
Correct
No move a step back ,we must have reach to X & Y by solving them individually
So Answer is solve(X)+solve(Y) + X
Y

This should help :slight_smile:

Yeah i got you.Thanks it was halpful. :slight_smile:

1 Like

If u dont have any other doubt in this then please mark it as resolved @asknishant.39 :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.