提交记录 903


用户 题目 状态 得分 用时 内存 语言 代码长度
AwD 1001. 测测你的排序 Accepted 100 1.69 s 781272 KB C 926 B
提交时间 评测时间
2018-06-20 17:41:05 2020-07-31 20:44:17
int cnt[3000];
unsigned bi[(int)(1e8 + 5)];
void sort(unsigned *a, int n)
{
    unsigned *ai = a;
    for (int i = 0; i < (1 << 11); ++ i) cnt[i] = 0;
    for (int i = 0; i < n; ++ i) cnt[ai[i] & ((1 << 11) - 1)] ++;
    for (int i = 1; i < (1 << 11); ++ i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; -- i) bi[-- cnt[ai[i] & ((1 << 11) - 1)]] = ai[i];

    for (int i = 0; i < (1 << 11); ++ i) cnt[i] = 0;
    for (int i = 0; i < n; ++ i) cnt[(bi[i] >> 11) & ((1 << 11) - 1)] ++;
    for (int i = 1; i < (1 << 11); ++ i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; -- i) ai[-- cnt[(bi[i] >> 11) & ((1 << 11) - 1)]] = bi[i];

    for (int i = 0; i < (1 << 11); ++ i) cnt[i] = 0;
    for (int i = 0; i < n; ++ i) cnt[ai[i] >> 22] ++;
    for (int i = 1; i < (1 << 11); ++ i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; -- i) bi[-- cnt[ai[i] >> 22]] = ai[i];

    for (int i = 0; i < n; ++ i) ai[i] = bi[i];
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #11.69 s762 MB + 984 KBAcceptedScore: 100


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