提交记录 39229


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 1001. 测测你的排序 Accepted 100 2.598 s 781772 KB C 681 B
提交时间 评测时间
2026-08-15 11:20:14 2026-08-15 11:20:21
// naive 16-bit 2-pass LSD, combined histogram (sol_v16c port to n=1e8)
typedef unsigned int u32;
static u32 tmp[100000000];
static u32 cnt[131072];
void sort(unsigned *aa, int n) {
    u32 *a = (u32*)aa;
    int i;
    for (i = 0; i < 131072; i++) cnt[i] = 0;
    for (i = 0; i < n; i++) { u32 x = a[i];
        cnt[0 + (x & 65535)]++;
        cnt[65536 + ((x>>16) & 65535)]++;
    }
    for (i = 1; i < 65536; i++) cnt[0+i] += cnt[0+i-1];
    for (i = 1; i < 65536; i++) cnt[65536+i] += cnt[65536+i-1];
    for (i = n-1; i >= 0; i--) { u32 x = a[i]; tmp[--cnt[0 + (x & 65535)]] = x; }
    for (i = n-1; i >= 0; i--) { u32 x = tmp[i]; a[--cnt[65536 + ((x>>16) & 65535)]] = x; }
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.598 s763 MB + 460 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2026-08-15 19:14:37 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠