提交记录 12065


用户 题目 状态 得分 用时 内存 语言 代码长度
user1 1001. 测测你的排序 Runtime Error 0 1.654 s 914932 KB C++11 854 B
提交时间 评测时间
2020-03-15 00:08:39 2020-08-01 02:50:46
#include <algorithm>
unsigned *x=new unsigned[1<<27];
void sort(unsigned* a, int n) {
    unsigned i=0, j=n, k;
    while (i<j) {
        if (a[i]<0x80000000U) {
            ++i;
        } else {
            std::swap(a[i], a[--j]);
        }
    }
    for (j=0; j<i; ++j) {
        unsigned t = a[j];
        x[t>>5] |= 1 << (t&31);
    }
    for (j=0, k=0; k<1<<27; ++k) {
        unsigned c=x[k];
        while (c) {
            unsigned q=__builtin_ctz(c);
            a[j++] = k<<5 | q;
            c &= c-1;
        }
        x[k] = 0;
    }
    for (j=i; j<n; ++j) {
        unsigned t = a[j];
        x[(t>>5)-(1<<27)] |= 1 << (t&31);
    }
    for (j=i, k=0; k<1<<27; ++k) {
        unsigned c=x[k];
        while (c) {
            unsigned q=__builtin_ctz(c);
            a[j++] = k<<5 | q | 0x80000000U;
            c &= c-1;
        }
    }
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #11.654 s893 MB + 500 KBRuntime ErrorScore: 0


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