#C12767. Find the Top Three Largest Unique Numbers

    ID: 42230 Type: Default 1000ms 256MiB

Find the Top Three Largest Unique Numbers

Find the Top Three Largest Unique Numbers

You are given a list of integers. Your task is to find the three largest unique numbers and output them sorted in descending order. If there are fewer than three unique numbers, pad the result with None (printed as the string "None") so that the final output always contains exactly three values.

Input Format: The first line contains an integer n denoting the number of elements in the list. The second line contains n space-separated integers. Note that if n is 0, no further input is given.

Output Format: Print three tokens separated by a single space. For any missing numbers (if there are less than three unique numbers), print None.

Examples:

  • Input: 5\n10 7 5 7 3 Output: 10 7 5
  • Input: 3\n10 10 10 Output: 10 None None
  • Input: 2\n1 2 Output: 2 1 None

Note: All formulas are rendered in LaTeX. For example, the descending order sorting is represented as \(a_1 \ge a_2 \ge a_3\).

inputFormat

The input consists of two lines. The first line contains a single integer \(n\), the number of elements. The second line contains \(n\) space-separated integers. If \(n = 0\), the second line is omitted.

outputFormat

Output exactly three tokens separated by spaces in one line. The tokens are the three largest unique numbers in descending order. If there are fewer than three unique numbers, output \(None\) (as text) for the missing values.

## sample
5
10 7 5 7 3
10 7 5