提交记录 13769


用户 题目 状态 得分 用时 内存 语言 代码长度
return20071007 wc2017b1. 【WC2017】挑战-任务1 Compile Error 0 0 ns 0 KB C++ 1.15 KB
提交时间 评测时间
2020-08-09 21:02:36 2020-08-09 21:02:37
#include <algorithm>
#pragma GCC optimize("Ofast", 3, "inline")
typedef unsigned int u32;
void sort(unsigned *a, int n) {
    u32 cnt[256];
    u32 *b = new u32[n];
    u32 ps = 0;
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < n; ++i) ++cnt[(a[i] >> ps) & 0xff];
    for (int i = 1; i < 256; ++i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; --i) b[--cnt[(a[i] >> ps) & 0xff]] = a[i];
    std::swap(a, b);
    ps = 8;
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < n; ++i) ++cnt[(a[i] >> ps) & 0xff];
    for (int i = 1; i < 256; ++i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; --i) b[--cnt[(a[i] >> ps) & 0xff]] = a[i];
    std::swap(a, b);
    ps = 16;
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < n; ++i) ++cnt[(a[i] >> ps) & 0xff];
    for (int i = 1; i < 256; ++i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; --i) b[--cnt[(a[i] >> ps) & 0xff]] = a[i];
    std::swap(a, b);
    ps = 24;
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < n; ++i) ++cnt[(a[i] >> ps) & 0xff];
    for (int i = 1; i < 256; ++i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; --i) b[--cnt[(a[i] >> ps) & 0xff]] = a[i];
    std::swap(a, b);
}

CompilationN/AN/ACompile ErrorScore: N/A


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