Time limit
1s
Memory limit
128 MB
A lock consists of N cells arranged in one row. Initially, cells 1 through N contain the numbers 1, 2, ..., N in that order.
To lock it, exactly three operations are performed in this order.
You are given the final locked state. Find values for the three operations that can produce it. If several answers are possible, output any one of them.
The first line contains the number of cells N. The value of N is between 10 and 500, inclusive.
The second line contains N integers, separated by spaces, giving the numbers in cells 1 through N after the lock has been locked.
On the first line, output k for the first k-left shift.
On the second line, output p and q for the (p,q)-interval reversal, separated by a space.
On the third line, output k for the final k-left shift.
If there are multiple valid answers, output any one of them.