#C2253. Square and Sort Positive Integers

    ID: 45549 Type: Default 1000ms 256MiB

Square and Sort Positive Integers

Square and Sort Positive Integers

Given an array of integers, remove non-positive integers, square the remaining positive integers, and then output them in sorted order in ascending sequence. For each integer (x) in the array, if (x > 0) then compute (x^2) and include it in the output. The squared numbers must be sorted in increasing order.

inputFormat

The input consists of two lines. The first line contains an integer (n) representing the number of integers in the array. The second line contains (n) space-separated integers.

outputFormat

Output the resulting squared positive integers in ascending order as a single line of space-separated values. If no positive integers exist, output an empty line.## sample

6
-2 -1 0 3 4 5
9 16 25