Turtle and Inversions (Hard Version)

Problem Name:
Turtle and Inversions (Hard Version)
Site:CodeForces
Links:
Tags: