提交记录 49023


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_dsh_v41_0919 1001a. 测测你的排序2 Accepted 100 83.95 us 120 KB C++17 891 B
提交时间 评测时间
2026-09-19 15:43:38 2026-09-19 15:43:40
#include <cstring>
void sort(unsigned *a, int n) {
    static unsigned h0[4096], h1[4096], h2[256];
    static unsigned tmp[1<<16];
    for (int i = 0; i < 4096; i++) { h0[i] = 0; h1[i] = 0; }
    for (int i = 0; i < 256; i++) h2[i] = 0;
    for (int i = 0; i < n; i++) { unsigned v = a[i]; h0[v & 4095]++; h1[(v >> 12) & 4095]++; h2[v >> 24]++; }
    unsigned s = 0;
    for (int i = 0; i < 4096; i++) { unsigned c = h0[i]; h0[i] = s; s += c; }
    s = 0; for (int i = 0; i < 4096; i++) { unsigned c = h1[i]; h1[i] = s; s += c; }
    s = 0; for (int i = 0; i < 256; i++) { unsigned c = h2[i]; h2[i] = s; s += c; }
    for (int i = 0; i < n; i++) { unsigned v = a[i]; tmp[h0[v & 4095]++] = v; }
    for (int i = 0; i < n; i++) { unsigned v = tmp[i]; a[h1[(v >> 12) & 4095]++] = v; }
    for (int i = 0; i < n; i++) { unsigned v = a[i]; tmp[h2[v >> 24]++] = v; }
    memcpy(a, tmp, n * 4);
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #183.95 us120 KBAcceptedScore: 100


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