Add penalty per cow. New goal: reduce . For each floor with work , compute the optimal number of cows to assign if each cow costs .
This is a separate improvement per floor! For floor : reduce over positive integers . The optimal is around . Try and , take the better one.