Zombies are after you. You need to improvise some sort of barricade
from whatever you find in the streets. The most useful items are large
cardboard boxes you load with bricks, as you can build tall stacks of them.
Given N boxes with positive weight, strength and height build the tallest tower (each item in the tower must have enough strength to bear the sum of the weights of the items above). |
http://www.instructables.com/id/Free-Boxes-Free-Waste-Removal/ |
Example input10 4 3 8 5 2 9 7 1 4 3 2 5 4 1 3 9 4 6 1 1 5 1 3 7 2 2 4 3 2 6 | Example output29 1 5 3 6 2 4 |