Problem 3520 · Hard

Minimum Threshold for Inversion Pairs Count

Binary search the threshold; for each guess count the index pairs whose descending gap fits under it.

Open the interactive visualisation