快排模板
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>
typedef long long LL;
using namespace std;
int a[100005];
int n;
void quick(int l, int r){
int x = l, y = r;
int mid = a[(l + r) / 2];
while(x < y){
while(a[x] < mid) x++;
while(a[y] > mid) y--;
if(x <= y) swap(a[x++], a[y--]);
}
if(l < y) quick(l, y);
if(x < r) quick(x, r);
}
int main()
{
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
scanf("%d", &n);
for (int i = 1; i <= n; i++){
scanf("%d", &a[i]);
}
quick(1, n);
printf("%d", a[1]);
for (int i = 2; i <= n; i++){
printf(" %d", a[i]);
}
printf("\n");
return 0;
}
/**/