Problem 3072 · Hard

Distribute Elements Into Two Arrays II

Send each element to the array holding more larger values, counting those values with two Fenwick trees over ranks.

Open the interactive visualisation