提交记录 14817


用户 题目 状态 得分 用时 内存 语言 代码长度
Exr0n 1001. 测测你的排序 Compile Error 0 0 ns 0 KB C++11 494 B
提交时间 评测时间
2020-11-13 09:14:16 2020-11-13 09:14:17
#include <utility>
#include <cstring>
void sort(unsigned *a, int n) {
    unsigned c[n];
    unsigned *b = c, pos[256];
    for (unsigned s=0; s<32; s+=8)
    {
        memset(pos, 0, sizeof pos); // FIX: clears-- pos
        for (int i=0; i<n; ++i) ++pos[a[i]>>s&0xff];
        for (int i=1; i<256; ++i) pos[i] += pos[i-1];
        for (int i=n-1; ~i; --i) b[--pos[a[i]>>s&0xff]] = a[i]; // FIX: bounds--start at n-1 not at n cuz zero index smah
        unsigned *t = b, b = a, a = t;
    }
}

CompilationN/AN/ACompile ErrorScore: N/A


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