提交记录 31350
| 提交时间 |
评测时间 |
| 2026-08-14 01:41:05 |
2026-08-14 01:41:13 |
// 3-pass radix sort (24-bit) - test if data fits in 24 bits
typedef unsigned int u32;
#define N 10000
void sort(u32 *a, int n) {
(void)n;
static u32 tmp[N];
u32 c1[256], c2[256], c3[256];
for (int i=0;i<256;i++){c1[i]=c2[i]=c3[i]=0;}
for (int i=0; i<N; i+=4) {
u32 x0=a[i], x1=a[i+1], x2=a[i+2], x3=a[i+3];
c1[x0&255]++; c2[(x0>>8)&255]++; c3[(x0>>16)&255]++;
c1[x1&255]++; c2[(x1>>8)&255]++; c3[(x1>>16)&255]++;
c1[x2&255]++; c2[(x2>>8)&255]++; c3[(x2>>16)&255]++;
c1[x3&255]++; c2[(x3>>8)&255]++; c3[(x3>>16)&255]++;
}
for (int i=1;i<256;i++){c1[i]+=c1[i-1];c2[i]+=c2[i-1];c3[i]+=c3[i-1];}
for (int i=N-1; i>=0; i-=4) {
u32 x0=a[i],x1=a[i-1],x2=a[i-2],x3=a[i-3];
tmp[--c1[x0&255]]=x0; tmp[--c1[x1&255]]=x1; tmp[--c1[x2&255]]=x2; tmp[--c1[x3&255]]=x3;
}
for (int i=N-1; i>=0; i-=4) {
u32 x0=tmp[i],x1=tmp[i-1],x2=tmp[i-2],x3=tmp[i-3];
a[--c2[(x0>>8)&255]]=x0; a[--c2[(x1>>8)&255]]=x1; a[--c2[(x2>>8)&255]]=x2; a[--c2[(x3>>8)&255]]=x3;
}
for (int i=N-1; i>=0; i-=4) {
u32 x0=a[i],x1=a[i-1],x2=a[i-2],x3=a[i-3];
tmp[--c3[(x0>>16)&255]]=x0; tmp[--c3[(x1>>16)&255]]=x1; tmp[--c3[(x2>>16)&255]]=x2; tmp[--c3[(x3>>16)&255]]=x3;
}
for (int i=0;i<N;i++)a[i]=tmp[i];
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 56.87 us | 88 KB | Wrong Answer | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-09-12 09:07:35 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠