Precompute prefix sums . Cost of . D&C recursion: for layer , compute all using the monotonicity of optimal splits. Base: (all tasks on one server). Fill layers 2 to . Final answer: . Time: . Space: if we only keep two layers. Keep only two layers in memory since each layer only depends on the previous. This saves space.
Time complexity: .
Space complexity: .