#C5471. Descending Road Segment Wear Levels

    ID: 49124 Type: Default 1000ms 256MiB

Descending Road Segment Wear Levels

Descending Road Segment Wear Levels

You are given multiple test cases. In each test case, you are provided with a number \(N\) representing the number of road segments and a list of integers representing the wear levels of these segments. Your task is to sort the wear levels in descending order. Although the problem hints at using a min-heap with negated values to emulate a max-heap, you can use any method that meets the requirements.

Note: The input begins with an integer \(T\) denoting the number of test cases. For each test case, the first line contains \(N\), and the second line contains \(N\) integers. Output each sorted list on a new line with values separated by a single space.

The solution must print the output to stdout and read the input from stdin.

inputFormat

The first line contains an integer (T), the number of test cases. Then for each test case:

  • The first line contains an integer (N), the number of road segments.
  • The second line contains (N) space-separated integers representing the wear levels.

outputFormat

For each test case, output the wear levels sorted in descending order on a new line. The numbers should be separated by a single space.## sample

2
5
10 20 15 30 40
3
5 4 7
40 30 20 15 10

7 5 4

</p>