UVa 102

From Algorithmist

Jump to: navigation, search

Contents

[edit] 102 - Ecological Bin Packing

[edit] Summary

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

[edit] 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.

[edit] Gotcha's

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

[edit] Input

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

[edit] Output

BCG 30
CBG 50
Personal tools