Inversions problem

2020 VietMX 0

You are given a permutation of n numbers p 1, p 2, …, p n. We perform k operations of the following type: choose uniformly at random two indices l and r ( l ≤ r) and reverse the order of the elements p l, p l + 1, …, p r. […]