#C14608. Square and Sort Non-negative Numbers

    ID: 44276 Type: Default 1000ms 256MiB

Square and Sort Non-negative Numbers

Square and Sort Non-negative Numbers

Given a list of integers, your task is to remove all negative numbers and duplicate values, then square the remaining numbers. Finally, output the squared values in non-decreasing order.

Note: If there are no non-negative numbers after filtering, output an empty line.

The mathematical operation for squaring a number is given by: \(x^2\), where \(x\) is a non-negative integer.

inputFormat

The input is read from stdin and consists of two lines:

  • The first line contains a single integer \(N\) (0 \(\leq N \leq\) 105), representing the number of elements in the list.
  • The second line contains \(N\) space-separated integers.

outputFormat

Output the squared values of all non-negative integers (after removing duplicates) in non-decreasing order to stdout. The numbers should be separated by a single space. If there are no valid numbers, output an empty line.

## sample
5
1 -2 3 -4 5
1 9 25