#C14859. Sorted Squares

    ID: 44554 Type: Default 1000ms 256MiB

Sorted Squares

Sorted Squares

Given a list of integers, compute the square of each element and sort the resulting values in non-decreasing order. The square of a number (x) is defined as (x^2). This problem tests your ability to manipulate arrays, perform element-wise operations, and sort the results efficiently. The input may contain negative numbers, and your solution should handle them correctly.

inputFormat

The input consists of two lines. The first line contains a single integer (n), representing the number of elements in the list. The second line contains (n) space-separated integers.

outputFormat

Output a single line containing the squared values of the list, sorted in non-decreasing order and separated by a single space.## sample

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