Mislav has N glasses of unlimited volume, and every glass holds some water. He wants to drink all of the water, but he does not want to drink from more than K glasses. The only thing he can do is pour all of the water from one glass into another glass.
The glasses are not all the same distance away from him, so the choice of glasses matters. Pouring the water from glass i into glass j costs Cij effort.
Find the smallest total effort needed to leave water in at most K glasses.