UVa 102 - Ecological Bin Packing

Summary
The small constraints make Bruteforce/Exhaustive Search feasible, and it's trivial to take the best of the rest.

Explanation
Since there are only three types of bottles, we can enumerate the $$3! = 6$$ places to put the bottles, and the rest is trivial.

Gotcha's

 * If there is more than one minimal solution, pick the one that comes lexicographically first.

Input
1 2 3 4 5 6 7 8 9 5 10 5 20 10 5 10 20 10

Output
BCG 30 CBG 50

Solution

 * C++: http://acm-solution.blogspot.com/2010/08/acm-uva-102-ecological-bin-packing.html
 * Code All the Problems