LEBALONS - Editorial

@darkshadows I think you have made a typo in the editorials. One of " Author’s solution " or " Setter’s solution " should be " Tester’s solution " , in my opinion .

suppose u have n balloons of color i…
and u want to check how many times balloon k occurs in all the 2^n possibilities …
the number of possibilities will be 2^(n-1)(take balloon k and from the remaining choose as many as u want)…
so the amount of cost that will be added for this balloon = 2^(n-1)* cost of k’th balloon …
so, for all the ‘n’ balloons = 2^(n-1) * sum of all the costs = 2^(n-1) * cost[i]

4 Likes

@betlista can you please tell what is wrong with this code. Though it gives correct ans, it is wa on codechef. this is the result on codechef. Thanks!

the cost of selecting the ith color is last two terms collectively