传送门(排序)
rt, 猴子排序可以过两个点(doge)
#include<bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
srand(time(0));
int n;
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i];
while(1) {
int cnt = 0;
for(int p = 1; p <= n * 2; p++) {
int i = rand() % n + 1, j = rand() % n + 1;
if(a[i] > a[j] && i < j) swap(a[i], a[j]);
}
for(int i = 1; i < n; i++) if(a[i] <= a[i + 1]) cnt++;
if(cnt == n - 1) break;
}
for(int i = 1; i < n; i++) cout << a[i] << " ";
cout << a[n] << endl;
return 0;
}