#P6823. 「EZEC-4」paulzrm Loves Array
「EZEC-4」paulzrm Loves Array
Description
Xiao Z has a sequence of length with indices starting from . Initially, the number at position is . There are operations, and each operation is one of the following four types.
1Sort the sequence in increasing order.2Sort the sequence in increasing order and then reverse it (i.e., sort in decreasing order).3 x ySwap the numbers at indices and . It is guaranteed that and .4Reverse the sequence.
You need to output the sequence after operations.
Input Format
The first line contains two integers , representing the length of the sequence and the number of operations.
The next lines each contain one operation. It is guaranteed that all operations are valid.
Output Format
Output one line containing integers, representing the sequence after all operations.
5 5
1
2
3 2 4
4
3 1 5
5 4 3 2 1
Hint
Constraints
This problem uses bundled testdata.
subtask 1 (24 pts): .
subtask 2 (13 pts): There is no operation of type 3.
subtask 3 (63 pts): .
Sample Explanation
The operations applied to the sequence are:
Translated by ChatGPT 5
京公网安备 11011102002149号