#C6773. Nth Largest Unique Number

    ID: 50570 Type: Default 1000ms 256MiB

Nth Largest Unique Number

Nth Largest Unique Number

You are given a list of integers and a positive integer \( n \). Your task is to find the \( n \)th largest unique integer in the list.

Formally, let \( S \) be the set of distinct integers from the input. Sort \( S \) in descending order. The answer is the element at index \( n-1 \) of this sorted list (using 0-indexing). If \( n \) is greater than the number of unique integers in the list, output "None".

Note: The solution should read input from standard input (stdin) and print the result to standard output (stdout).

inputFormat

The input consists of two lines:

  • The first line contains a sequence of integers separated by spaces. This line may be empty, representing an empty list.
  • The second line contains a single integer \( n \), representing the ranking of the unique integer to retrieve.

For example: 4 1 2 3 4 5 in the first line and 3 in the second line.

outputFormat

Output a single line:

  • If the \( n \)th largest unique integer exists, output that integer.
  • If it does not exist, output the string None.
## sample
4 1 2 3 4 5
3
3