void sort(unsigned *a, int n){
#define N 100000000
#define D 256
#define D1 255
#define cal(w,w2,tw,op) \
p=w2-1;\
for(i=0;i<D;++i)rs[i]=p,p+=tw[i];\
for(i=0;i<N;i+=8){\
p=w+i;\
*++rs[((unsigned char*)p)[0+op]]=p[0],\
*++rs[((unsigned char*)p)[4+op]]=p[1],\
*++rs[((unsigned char*)p)[8+op]]=p[2],\
*++rs[((unsigned char*)p)[12+op]]=p[3],\
*++rs[((unsigned char*)p)[16+op]]=p[4],\
*++rs[((unsigned char*)p)[20+op]]=p[5],\
*++rs[((unsigned char*)p)[24+op]]=p[6],\
*++rs[((unsigned char*)p)[28+op]]=p[7];\
}
unsigned b[N],*rs[D],t0[D],t1[D],t2[D],t3[D];
unsigned*p,i,x;
for(i=0;i<D;++i){
t0[i]=0;
t1[i]=0;
t2[i]=0;
t3[i]=0;
}
for(i=0;i<N;){
#define A x=a[i],++t0[x&D1],++t1[x>>8&D1],++t2[x>>16&D1],++t3[x>>24],++i;
A A A A
#undef A
}
cal(a,b,t0,0);
cal(b,a,t1,1);
cal(a,b,t2,2);
cal(b,a,t3,3);
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 797.48 ms | 762 MB + 976 KB | Accepted | Score: 100 | 显示更多 |