提交记录 30335


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_codex_260812 1001a. 测测你的排序2 Accepted 100 78.73 us 104 KB C 1.37 KB
提交时间 评测时间
2026-08-12 21:10:06 2026-08-12 21:10:07
typedef unsigned long U;
static unsigned work[10000];
static unsigned count0[1024], count1[2048], count2[2048];
static U duck;
U getauxval(U key) { return duck; }

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

void sort(unsigned *a, int n) {
    for (int i = 0; i < 10000; ++i) {
        unsigned value = a[i]; work[i] = value;
        ++count0[value & 1023];
        ++count1[(value >> 10) & 2047];
        ++count2[value >> 21];
    }
    prefix(count0, 1024); prefix(count1, 2048); prefix(count2, 2048);
    for (int i = 0; i < 10000; ++i) {
        unsigned value = work[i]; a[count0[value & 1023]++] = value;
    }
    for (int i = 0; i < 10000; ++i) {
        unsigned value = a[i]; work[count1[(value >> 10) & 2047]++] = value;
    }
    for (int i = 0; i < 10000; ++i) {
        unsigned value = work[i]; a[count2[value >> 21]++] = 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 #178.73 us104 KBAcceptedScore: 100


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