提交记录 142465


用户 题目 状态 得分 用时 内存 语言 代码长度
m1979823301 1001. 测测你的排序 Accepted 100 804.357 ms 781264 KB C++ 767 B
提交时间 评测时间
2026-11-07 15:19:58 2026-11-07 15:20:02

static unsigned b[100000000];

template<int shift>
inline void radix(const unsigned *src, unsigned *dst,
                  int n, unsigned *cnt) {
    for (int i = n - 1; i >= 0; --i) {
        unsigned x = src[i];
        dst[--cnt[(x >> shift) & 255u]] = x;
    }
}

void sort(unsigned *a, int n) {
    unsigned cnt[4][256] = {};

    for (int i = 0; i < n; ++i) {
        unsigned x = a[i];
        ++cnt[0][x & 255u];
        ++cnt[1][(x >> 8) & 255u];
        ++cnt[2][(x >> 16) & 255u];
        ++cnt[3][x >> 24];
    }

    for (int k = 0; k < 4; ++k)
        for (int j = 1; j < 256; ++j)
            cnt[k][j] += cnt[k][j - 1];

    radix<0>(a, b, n, cnt[0]);
    radix<8>(b, a, n, cnt[1]);
    radix<16>(a, b, n, cnt[2]);
    radix<24>(b, a, n, cnt[3]);
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1804.357 ms762 MB + 976 KBAcceptedScore: 100


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