USACO 2019 US Open Contest, Gold Problem 3. Balancing Inversions
Bessie and Elsie were playing a game on a boolean array AA of length 2N2N (1≤N≤1051≤N≤105). Bessie's score was the number of inversions in the first half of AA, and Elsie's score was the number of ...