3958. Minimum Cost to Split into Ones II
Math
Hints
Hint 1
Let
f(x) be the minimum total cost to split x into ones.Hint 2
If you split
x into a and b, then f(x) = a * b + f(a) + f(b).Hint 3
Look for an invariant: the total cost may depend only on the final set of pieces, not on the order of splits.
Preparing judge…