提交记录 48025


用户 题目 状态 得分 用时 内存 语言 代码长度
jiegec 1001a. 测测你的排序2 Accepted 100 62.74 us 88 KB C 1.83 KB
提交时间 评测时间
2026-09-13 11:29:47 2026-09-13 11:29:49
// This code is AI-generated. (AI 生成的代码)
// 1001a: sort 10000 unsigned ints.  Four 8-bit LSD passes; the histogram of the
// next digit is fused into the scatter of the previous pass so each pass reads
// the array only once.  A custom __libc_start_main calls the harness directly.
typedef unsigned long U;
static unsigned work[10000];
static unsigned short counts[4][256];
static U duck;

U getauxval(U key) { (void)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) {
    (void)n;
    for (int i = 0; i < 10000; ++i) ++counts[0][a[i] & 255];
    prefix(counts[0]);
    for (int i = 0; i < 10000; ++i) {
        unsigned value = a[i];
        work[counts[0][value & 255]++] = value;
        ++counts[1][(value >> 8) & 255];
    }
    prefix(counts[1]);
    for (int i = 0; i < 10000; ++i) {
        unsigned value = work[i];
        a[counts[1][(value >> 8) & 255]++] = value;
        ++counts[2][(value >> 16) & 255];
    }
    prefix(counts[2]);
    for (int i = 0; i < 10000; ++i) {
        unsigned value = a[i];
        work[counts[2][(value >> 16) & 255]++] = 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.74 us88 KBAcceptedScore: 100


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