#K45332. Top Donors Filtering

    ID: 27730 Type: Default 1000ms 256MiB

Top Donors Filtering

Top Donors Filtering

You are given a list of donation amounts and a threshold value. Your task is to filter out all donations that are less than the threshold and then output the remaining donations in descending order.

Formally, given a list \(D = [d_1, d_2, \ldots, d_n]\) and an integer \(T\), you are to output the list \(R = [r_1, r_2, \ldots, r_k]\) where each \(r_i\) satisfies \(r_i \ge T\) and \(R\) is sorted in descending order. If no donation meets the threshold, output an empty line.

Example: For the input list [50, 120, 75, 30, 200, 60] with threshold 70, the output should be 200 120 75.

inputFormat

The first line contains an integer \(n\) representing the number of donations. The second line contains \(n\) space-separated integers representing the donation amounts. The third line contains an integer \(T\) representing the threshold value.

For example:

6
50 120 75 30 200 60
70

outputFormat

Output the donations that are greater than or equal to the threshold \(T\), sorted in descending order and separated by a space. If no donation meets the threshold, output an empty line.

For example, the output for the sample input above is:

200 120 75
## sample
6
50 120 75 30 200 60
70
200 120 75