Can someone tell me how to solve Choosing from Buckets problem ? asked 30 Dec '18, 00:35

Chosing a ball from bucket have two outcomes 
For first bucket  Probability that ball has ith color = (No of balls with ith color) / Total balls for consecutive bucket k  Case1  The ball added to bucket k had color i Probability that new ball taken out of bucket k has ith color = Probability that ball with ith color came out of previous bucket * (1 + count of balls with color i in kth bucket)/ (1 + Total balls in bucket k) Case2  The ball added to bucket k did not had color i Probability that new ball taken out of bucket k has ith color = (1  Probability that ball with ith color came out of previous bucket) * (count of balls with color i in kth bucket)/ (1 + Total balls in bucket k) Total probability = Case1 + case 2 Calculate this for each color for each bucket. answered 30 Dec '18, 00:47

Calculate probability for each color(1 to k) by looping from 1 to n and using simple formula prob[i]=(prob[i1](colorcnt+1))/(totalcnt+1) + ((1prob[i1])(colorcnt))/(totalcnt+1). Reason : with probability[i1] we will get this color from previous lot, and color count in this lot will increase by 1 and with 1probability[i1] we will get different color from previous lot and color count in this lot will remain the same whereas total count will increase by 1 in both cases. (For the start prob[1] is simply colorcnt_in_1/total_cnt_of_1 ) For better reference of the above text see this solution : https://www.codechef.com/viewsolution/22121098 answered 30 Dec '18, 00:55

see my solution. written in most easy way to understand. solve(x,y) is probability for xth ball color to come out in yth bucket.
answered 30 Dec '18, 13:12

Can Anyone point out the mistake with this solution. answered 30 Dec '18, 16:15

My solution https://www.codechef.com/viewsolution/22135834 answered 30 Dec '18, 16:39
