Skip to content

QOJ10100 交换 Kubic 3

Step 1

We obviously try to split the negative ranges and move to either side. This comes with a caveat, we need to make sure the side we choose can take all of the negative's sum. There is also another case, because we can accumulate it on the the positive range.

Another idea, we are going to split it into some number of \(s[l..r] \ge 0\). The yields a \(\mathcal{O}(n^2)\) algorithm. Can every \(s[l \dots r]\) work though?

(THIS IS FROM THE SLIDE, NEED MANUAL DERIVATION AND CHECKS) We require \(s[\)

TBD

Step 2

We consider how to optimize this.