UVa 102 - Ecological Bin Packing

102 - Ecological Bin Packing

 * http://acm.uva.es/p/v1/102.html

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