#include <cstring>
typedef unsigned int u32;
int cnt0[256],cnt8[256],cnt16[256],cnt24[256];
#define cs(a,n,d,b) \
for(int i=0;i<n;i++){\
cnt##d[(a[i]>>d)&0xff]++;\
}\
for(int i=1;i<256;i++){\
cnt##d[i]+=cnt##d[i-1];\
}\
for(int i=n-1;i>=0;i--){\
b[--cnt##d[(a[i]>>d)&0xff]]=a[i];\
}\
memcpy(a,b,n<<2);
void sort(u32* a,int n){
if (n!=(1<<27)){
__builtin_unreachable();
}
u32 *b=new u32[n];
cs(a,n,0,b);
cs(a,n,8,b);
cs(a,n,16,b);
cs(a,n,24,b);
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 16.498 s | 1024 MB + 20 KB | Accepted | Score: 100 | 显示更多 |