luogu#P7981. [JRKSJ R3] system
[JRKSJ R3] system
Problem Description
Define one operation on a sequence as setting , and then setting , where .
You are given a sequence of length . Ask for the sequence after performing the operation on exactly times.
Input Format
The first line contains two integers .
The second line contains integers representing the sequence .
Output Format
Output one line with integers, representing the sequence after operations.
5 2
2 5 4 3 1
2 5 3 4 1
20 233
1 1 5 6 8 15 10 11 18 14 4 16 16 11 3 5 1 15 4 5
1 1 4 5 6 8 4 15 5 6 3 11 11 15 11 4 1 8 3 4
Hint
Sample Explanation
For Sample , the changes of are as follows:
Constraints
This problem uses bundled testdata.
| Special Property | Score | ||
|---|---|---|---|
| None | |||
| None |
Property : .
Property : .
Property : is a permutation of .
For of the testdata, , , .
Translated by ChatGPT 5