Problem 3907 · Medium

Count Smaller Elements With Opposite Parity

For each index, count later values of the other parity that are strictly smaller, scanning from the right with two sorted shelves.

Open the interactive visualisation