提交记录 9383


用户 题目 状态 得分 用时 内存 语言 代码长度
Crossing 1001. 测测你的排序 Accepted 100 802.633 ms 781288 KB C++11 759 B
提交时间 评测时间
2019-05-05 20:51:48 2020-08-01 01:37:19

#include <bits/stdc++.h>
 
const int N = 1e8 + 7, maxv = 1 << 8;
 
void sort(unsigned int *a, int n) {
    unsigned int c1[maxv], c2[maxv], c3[maxv], c4[maxv], b[N];
    for (int i = 0; i < n; i++) {
        c1[a[i] & (maxv - 1)]++;
        c2[(a[i] >> 8) & (maxv - 1)]++;
        c3[(a[i] >> 16) & (maxv - 1)]++;
        c4[a[i] >> 24]++;
    }
    for (int i = 1; i < maxv; i++) c1[i] += c1[i - 1], c2[i] += c2[i - 1], c3[i] += c3[i - 1], c4[i] += c4[i - 1];
    for (int i = n - 1; i >= 0; i--) b[--c1[a[i] & (maxv - 1)]] = a[i];
    for (int i = n - 1; i >= 0; i--) a[--c2[(b[i] >> 8) & (maxv - 1)]] = b[i];
    for (int i = n - 1; i >= 0; i--) b[--c3[(a[i] >> 16) & (maxv - 1)]] = a[i];
    for (int i = n - 1; i >= 0; i--) a[--c4[b[i] >> 24]] = b[i];
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1802.633 ms762 MB + 1000 KBAcceptedScore: 100


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