提交记录 20633


用户 题目 状态 得分 用时 内存 语言 代码长度
platelet 1001. 测测你的排序 Runtime Error 0 164.242 ms 293944 KB C++17 832 B
提交时间 评测时间
2023-11-30 10:34:14 2023-11-30 10:34:19
#include <bits/stdc++.h>

using namespace std;

const int n = 1e8;
const double alpha = 1.007;

template <class T>
void F(uint* a, uint* b, T lambda) {
    uint *p[256], *p0[256];
    for (int i = 0; i < 256; i++)
        p[i] = p0[i] = b + int(n / 256 * i * alpha);
    for (int i = 0; i < n; i++) *p[lambda(a[i])]++ = a[i];
    auto ptr = a;
    for (int k = 0; k < 256; k++) {
        assert(p[k] <= b + int(n / 256 * (k + 1) * alpha));
        auto len = p[k] - p0[k];
        memcpy(ptr, p0[k], len * sizeof(uint));
        ptr += len;
    }
}

void sort(uint* a, int __n) {
    uint* b = (uint*)malloc(int(n * sizeof(uint) * alpha));
    F(a, b, [](uint x) { return x & 255; });
    F(a, b, [](uint x) { return x >> 8 & 255; });
    F(a, b, [](uint x) { return x >> 16 & 255; });
    F(a, b, [](uint x) { return x >> 24; });
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1164.242 ms287 MB + 56 KBRuntime ErrorScore: 0


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