Skip to main content

Inversion Doubles

Challenge on lesson: Final 1-A: Inversion Doubles

CHALLENGE
Difficulty: advanced+25 XP

**Problem.** Line 1: n. Line 2: n integers (may be negative). Print the number of pairs i < j with a[i] > 2*a[j]. **Constraints:** 1 <= n <= 200000; |a[i]| <= 1e6. Sweep + BIT synthesis; negatives allowed.

Back to lesson: Final 1-A: Inversion Doubles