#K78847. Reorder Tasks by Priority
Reorder Tasks by Priority
Reorder Tasks by Priority
Jackson has a list of tasks, each with an associated priority. His goal is to complete the tasks in the order of their priorities, starting with the tasks with the highest priority. The problem is to reorder the given list of tasks so that the priorities are sorted in descending order.
Mathematically, given a list \(P = [p_1, p_2, \dots, p_n]\), you need to output a list \(P'\) such that \(P'\) is a permutation of \(P\) and \(p'_1 \ge p'_2 \ge \dots \ge p'_n\).
The input will be given through standard input and the output should be displayed to standard output.
inputFormat
The first line of input contains a single integer \(n\) \( (1 \leq n \leq 10^5) \) representing the number of tasks. The second line contains \(n\) space-separated integers representing the priorities of the tasks.
outputFormat
Output a single line with the \(n\) task priorities sorted in descending order, separated by a single space.
## sample5
1 3 5 2 4
5 4 3 2 1