Editorial for Another Contest 5 Problem 5 - Another Cheese Problem
Submitting an official solution before solving the problem yourself is a bannable offence.
An obvious lower bound for the number of bowls that is needed is the maximum number of operations one operation directly depends on, plus one. This is directly implied by the problem statement.
However, this figure is not always attainable. By way of contradiction, let operation 1 be dependent on operations 2 and 3. If we know a priori that both operations need 10 bowls to complete, then we actually need 11 bowls to complete operation 1. We arbitrarily pick one of the operations to complete, and then we need to allocate one bowl to store that intermediate result, and then we need 10 more bowls to complete the other operation.
This leads us to our first critical realization - given operations
What order should we commit to finishing them in? Intuitively, we should commit to the operations
which use the most bowls first. Formally, let
This runs in
Comments