#include<vecor>
class Solution {
public:
void quick_sort(vector<int> &num, int low1, int high1)
{
int tmp = num[low1];
int low = low1,high = high1;
if(low>=high) return;
while(low<high)
{
while(low<high&&num[high]>=tmp)
{
high --;
}
if(low <high)
{
int t = num[low];
num[low] =num[high];
num[high] = t;
low ++;
}
while(low<high&&num[low]<=tmp)
{
low ++;
}
if(low<high)
{
int t = num[low];
num[low] =num[high];
num[high] = t;
high --;
}
}
num[low] = tmp;
quick_sort(num,low1,low-1);
quick_sort(num,low+1,high1);
}
vector<int> sortedSquares(vector<int>& A) {
vector<int> num;
int l = A.size();
for(int i=0;i<l;i++)
{
num.push_back(A[i]*A[i]);
}
quick_sort(num,0,l-1);
return num;
}
};