## Twist the Permutation solution codeforces – Petya got an array aa of numbers from 11 to nn, where a[i]=ia[i]=i. He performed nn operations sequentially

Twist the Permutation solution codeforces Petya got an array aa of numbers from 11 to nn, where a[i]=ia[i]=i. He performed nn operations sequentially. In the end, he received a new state of the aa array. At the ii-th operation, Petya chose the first ii elements of the array and cyclically shifted them to the right an arbitrary number of times (elements with indexes i+1i+1 and more remain in their places). … Read more