const int S=1<<8,l=8,N=2e8,S1=S-1;
#define _For(i,l,r) for(int i=l,i##end=r;i<i##end;++i)
inline void __sort(unsigned *a,const int n,int k) {
k*=l;
static unsigned h[S],b[N],s,tmp;
_For(i,0,S)h[i]=0;
_For(i,0,n)b[i]=a[i],h[(b[i])>>k&S1]++;
s=*h;*h=0;_For(i,1,S)tmp=h[i],h[i]=s,s+=tmp;
_For(i,0,n)a[h[b[i]>>k&S1]++]=b[i];
}
void sort(unsigned *a,const int n) {
_For(i,0,32/l)__sort(a,n,i);
}
#undef _For
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 961.913 ms | 762 MB + 980 KB | Accepted | Score: 100 | 显示更多 |