LEPAINT - Editorial

I have a doubt. Suppose we know L <= j <= R. // if( j>=L && j<=R)//
Why did we still consider this below condition even we know L <= j <= R??
//if you don’t chose it [ probability that you do not take it in subset is 0.5 ]
//dp[i][j][k] += dp[i-1][j][k]*0.5

alt text

@devuy11 we are increasing the probability of dp[i][j][(m*k)%C] if index is choosen in the subset. would’nt it lead to decrease in the probability of rest of colors because the summation of probability of all colors at each index in each step is 1?

Great tutorial on DP and probability theory!! Thanks…