提交记录 7784


用户 题目 状态 得分 用时 内存 语言 代码长度
JacaJava 1001. 测测你的排序 Accepted 100 931.156 ms 781260 KB C++ 825 B
提交时间 评测时间
2019-01-25 10:02:37 2020-08-01 01:08:31
void sort(unsigned *a, int n){
    const int S = 8;
    unsigned _b[100000005], *b;
    register unsigned cnt[256];
    int i;
    b = _b;
    for (i = 0; i < 32; i += S) {
        for (int j = 0; j < 256; j++) cnt[j] = 0;
        if (i + S >= 32) {
            for (int j = 0; j < n; j++) ++cnt[a[j] >> i];
            for (int j = 1; j < 1 << S; j++) cnt[j] += cnt[j - 1];
            for (int j = n - 1; j >= 0; j--) b[--cnt[a[j] >> i]] = a[j];
            unsigned *tmp = a;
            a = b, b = tmp;
            continue;
        }
        int t = (1 << S) - 1;
        for (int j = 0; j < n; j++) ++cnt[(a[j] >> i) & t];
        for (int j = 1; j < 1 << S; j++) cnt[j] += cnt[j - 1];
        for (int j = n - 1; j >= 0; j--) b[--cnt[(a[j] >> i) & t]] = a[j];
        unsigned *tmp = a;
        a = b, b = tmp;
    }
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1931.156 ms762 MB + 972 KBAcceptedScore: 100


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