#C8034. Sorted Squares
Sorted Squares
Sorted Squares
Given a sorted list of integers, return a new list where each number is squared and then sorted in non-decreasing order. In other words, for each element \(x\) in the list, compute \(x^2\) and output the sorted result.
For example, if the input is -4 -1 0 3 10
, then the output should be 0 1 9 16 100
.
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, which are sorted in non-decreasing order.
outputFormat
Output a single line containing \(n\) space-separated integers which represent the squared values of the input numbers, sorted in non-decreasing order.
## sample5
-4 -1 0 3 10
0 1 9 16 100