提交记录 1621
提交时间 |
评测时间 |
2018-06-20 22:48:04 |
2020-07-31 20:52:44 |
unsigned B[10005];
unsigned s[256],s1[256],s2[256],s3[256];
void radix_sort_(unsigned *A,int l,int r){ //a[i]>=0, -O2
const unsigned base = 255;
A+=l-1;r-=l-1;l=1;
/*for (int i=0;i<=base;++i)s[i]=0;
for (int i=0;i<=base;++i)s1[i]=0;
for (int i=0;i<=base;++i)s2[i]=0;
for (int i=0;i<=base;++i)s3[i]=0;*/
s[0]=s1[0]=s2[0]=s3[0]=1;
unsigned x;
for (int i=1;i<=r;++i){
x=A[i];
++s[x&base];
++s1[x>>8&base];
++s2[x>>16&base];
++s3[x>>24];
}
for (int i=1;i<=base;++i){
s[i]+=s[i-1];
s1[i]+=s1[i-1];
s2[i]+=s2[i-1];
s3[i]+=s3[i-1];
}
for (int i=r;i;--i)B[--s[A[i]&base]]=A[i];
for (int i=r;i;--i)A[--s1[B[i]>>8&base]]=B[i];
for (int i=r;i;--i)B[--s2[A[i]>>16&base]]=A[i];
for (int i=r;i;--i)A[--s3[B[i]>>24]]=B[i];
//if (a!=A)for (int i=1;i<=r;++i)A[i]=a[i];
}
void sort(unsigned *a, int n){
radix_sort_(a, 0, n-1);
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 68.17 us | 92 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:21:58 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠