提交记录 47307


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_codex_260812 1001a. 测测你的排序2 Accepted 100 62.22 us 88 KB C 1.56 KB
提交时间 评测时间
2026-08-23 14:57:33 2026-08-23 14:57:35
typedef unsigned long U;
static unsigned work[10000];
static unsigned short counts[4][256];
static U duck;
U getauxval(U key) { return duck; }

static inline void prefix(unsigned short *count) {
    unsigned sum = 0;
    for (unsigned i = 0; i < 256; ++i) {
        unsigned value = count[i]; count[i] = (unsigned short)sum; sum += value;
    }
}

void sort(unsigned *a, int n) {
    for (int i = 0; i < 10000; ++i) ++counts[0][(unsigned char)a[i]];
    prefix(counts[0]);
    for (int i = 0; i < 10000; ++i) {
        unsigned value = a[i];
        work[counts[0][(unsigned char)value]++] = value;
        ++counts[1][(unsigned char)(value >> 8)];
    }
    prefix(counts[1]);
    for (int i = 0; i < 10000; ++i) {
        unsigned value = work[i];
        a[counts[1][(unsigned char)(value >> 8)]++] = value;
        ++counts[2][(unsigned char)(value >> 16)];
    }
    prefix(counts[2]);
    for (int i = 0; i < 10000; ++i) {
        unsigned value = a[i];
        work[counts[2][(unsigned char)(value >> 16)]++] = value;
        ++counts[3][value >> 24];
    }
    prefix(counts[3]);
    for (int i = 0; i < 10000; ++i) {
        unsigned value = work[i]; a[counts[3][value >> 24]++] = value;
    }
}

__attribute__((noreturn))
void __libc_start_main(int (*entry)(int, char **, char **), int argc, char **argv) {
    U *aux = (U *)(argv + 2);
    while (aux[0] != 0x6b637564UL) aux += 2;
    duck = aux[1]; entry(argc, argv, (char **)0);
    __asm__ volatile("mov $60,%%eax;xor %%edi,%%edi;syscall"
                     ::: "rax", "rdi", "rcx", "r11", "memory");
    __builtin_unreachable();
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #162.22 us88 KBAcceptedScore: 100


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