Sandman25 wrote:I see, we are trying to combine dropping books and dropping items to make room for more books.

Two problems with that:

- There's no advantage to combining dropping items and books. Maybe you meant picking up?

- In the case of an even number of books it's also not necessary to combine them.

The reason why this problem was (at least to me) a bit counter-intuitive is this: At first it seemed that maximising the number of items picked up in one go is the right strategy, because you get to pick up stuff 'for free'. But on examination the 'rate determining' step is dropping items and the fastest solutions balance time spent dropping items with picking up stacks of items. The total time spent dropping books is fixed, but the time spent dropping non-book items can be varied.

Imagine you have 30 books and split them in two stacks. Now you drop 15 items, then process the books, in two stacks, then pick up the 15 items. You saved dropping 15 items (15 turns), at the cost of spending 2 turns picking up 15 books. Total overhead: 17 (drop 15 items + 2 turns picking up books)

Now imagine you split your books into 3 equal stacks of 10. Drop 10 items, process the books, pick up 10 items. You saved dropping 20 items (20 turns) at the cost of spending 3 turns picking up two stacks of 10 books. Total overhead: 13 (drop 10 items + 3 turns picking up books)

Split books into 5 stacks of 6 books. Drop 6 items, process books, pick up 6 items. Saved dropping 24 items (24 turns) at the cost of spending 5 turns picking up 5 stacks. Total overhead: 11 (drop 6 items + 5 turns picking up stacks of books)

The minimum is where the sum of turns spent dropping inventory items and turns spent picking up books is the smallest.

Maybe I'm talking nonsense.