#K14636. Zog Number Discovery
Zog Number Discovery
Zog Number Discovery
You are given a sequence of n integers and an integer k. In this problem, you are to "simulate" an operation that guarantees that after sufficient operations, the sequence will always be sorted in descending order. Formally, after applying k operations to the sequence, the result will be the sequence sorted in descending order.
The reason behind this is that, in each operation, the maximum element in the sequence is swapped in some way with the minimum element, eventually leading to a complete reversal of the natural order. In mathematical notation, if \(S = [s_1, s_2, \dots, s_n]\) is the input sequence, then the final sequence is given by:
\(\text{result} = sort(S)\_{\text{desc}}\)
Your task is to implement a program that reads the input, performs the operation (which effectively sorts the sequence in descending order), and outputs the transformed sequence.
inputFormat
The first line contains two integers n and k (\(1 \leq n \leq 10^5\), \(k \geq 0\)). The second line contains n space-separated integers representing the sequence.
Note: Although k is provided, its effect is abstracted and the answer is simply the input sequence sorted in descending order.
outputFormat
Output a single line with n integers, the resulting sequence sorted in descending order, separated by spaces.
## sample5 3
4 2 1 3 5
5 4 3 2 1