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 | 1.182 ms | 808 KB | Accepted | Score: 34 | 显示更多 |
Testcase #2 | 1.281 s | 762 MB + 988 KB | Accepted | Score: 33 | 显示更多 |
Testcase #3 | 2.563 s | 1525 MB + 924 KB | Accepted | Score: 33 | 显示更多 |