居然能过快排模板???
好像是说 stable_sort 在子序列有序的情况下不会继续递归了
#include<bits/stdc++.h>
using namespace std;
const int _SIZE = 1e5;
int n, a[_SIZE + 5];
void SORT(int l, int r) {
if (l == r) return;
int mid = (l + r) >> 1;
SORT(l, mid); SORT(mid + 1, r);
stable_sort(a + l, a + r + 1);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
SORT(1, n);
for (int i = 1; i <= n; i++) cout << a[i] << " ";
return 0;
}