提交记录 31280


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 1001. 测测你的排序 Accepted 100 2.527 s 781516 KB C 576 B
提交时间 评测时间
2026-08-14 01:12:31 2026-08-14 01:12:37
// 2-pass 16-bit LSD radix sort
typedef unsigned u32;
static u32 tmp[100000000];
static u32 cnt[65536];

void sort(u32 *a, int n) {
    u32 i;
    for (i = 0; i < 65536; i++) cnt[i] = 0;
    for (i = 0; i < (u32)n; i++) cnt[a[i] & 0xffff]++;
    for (i = 1; i < 65536; i++) cnt[i] += cnt[i-1];
    for (i = (u32)n; i-- > 0;) tmp[--cnt[a[i] & 0xffff]] = a[i];

    for (i = 0; i < 65536; i++) cnt[i] = 0;
    for (i = 0; i < (u32)n; i++) cnt[tmp[i] >> 16]++;
    for (i = 1; i < 65536; i++) cnt[i] += cnt[i-1];
    for (i = (u32)n; i-- > 0;) a[--cnt[tmp[i] >> 16]] = tmp[i];
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.527 s763 MB + 204 KBAcceptedScore: 100


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