提交记录 22517
提交时间 |
评测时间 |
2024-09-18 10:34:05 |
2024-09-18 10:34:07 |
#include<bits/stdc++.h>
const int N=1<<27,B=9;
unsigned b[N],cnt[1<<B];
void sort(unsigned *a,int n){
for(int p=0;p<3;p++){
for(int i=0;i<(1<<B);i++) cnt[i]=0;
for(int i=0;i<n;i++) cnt[(a[i]>>(B*p))&((1<<B)-1)]++;
for(int i=0;i<(1<<B);i++) cnt[i]+=cnt[i-1];
for(int i=n-1;i>=0;i--) b[--cnt[(a[i]>>(B*p))&((1<<B)-1)]]=a[i];
for(int i=1;i<=n;i++) a[i]=b[i];
}
}
unsigned in[N];
int main(){
#ifndef ONLINE_JUDGE
freopen("test.in","r",stdin);
freopen("test.out","w",stdout);
#endif
int n;
std::cin>>n;
for(int i=0;i<n;i++) std::cin>>in[i];
sort(in,n);
for(int i=0;i<n;i++) std::cout<<in[i]<<' ';
return 0;
}
Compilation | N/A | N/A | Compile Error | Score: N/A | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2025-07-12 17:41:07 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠