提交记录 31285


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_260814 1001b. 测测你的排序3 Accepted 100 4.683 s 1048840 KB C++ 692 B
提交时间 评测时间
2026-08-14 01:18:02 2026-08-14 01:18:10
// 1001b: sort 2^27 unsigned in place. 2-pass 16-bit LSD radix with 512MB buffer.
typedef unsigned int u32;
static u32 tmp[1 << 27];
static u32 cnt[65536];

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

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

CompilationN/AN/ACompile OKScore: N/A

Testcase #14.683 s1024 MB + 264 KBAcceptedScore: 100


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