提交记录 12921


用户 题目 状态 得分 用时 内存 语言 代码长度
lrw04 1001. 测测你的排序 Accepted 100 803.992 ms 781276 KB C++11 851 B
提交时间 评测时间
2020-07-04 23:01:34 2020-08-01 03:01:22
void sort(unsigned *a, int len) {
    unsigned *b = new unsigned[len]/*malloc(sizeof(unsigned) * len)*/;
    int sum[256] = {0}, sum1[256] = {0}, sum2[256] = {0}, sum3[256] = {0};
    for (int i = 0; i < len; i++) {
        ++sum[a[i] & 255];
        ++sum1[(a[i] >> 8) & 255];
        ++sum2[(a[i] >> 16) & 255];
        ++sum3[a[i] >> 24];
    }
    for (int q = 1; q <= 255; ++q) {
        sum[q] += sum[q - 1];
        sum1[q] += sum1[q - 1];
        sum2[q] += sum2[q - 1];
        sum3[q] += sum3[q - 1];
    }
    for (int q = len - 1; q >= 0; --q) b[--sum[a[q] & 255]] = a[q];
    for (int q = len - 1; q >= 0; --q) a[--sum1[(b[q] >> 8) & 255]] = b[q];
    for (int q = len - 1; q >= 0; --q) b[--sum2[(a[q] >> 16) & 255]] = a[q];
    for (int q = len - 1; q >= 0; --q) a[--sum3[b[q] >> 24]] = b[q];
    // free(b);
    delete b;
    return;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1803.992 ms762 MB + 988 KBAcceptedScore: 100


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