提交记录 27773


用户 题目 状态 得分 用时 内存 语言 代码长度
Izumi_Sagiri wc2017b1. 【WC2017】挑战-任务1 Compile Error 0 0 ns 0 KB C++ 619 B
提交时间 评测时间
2025-01-20 01:09:46 2025-01-20 01:09:47
void countingSort(unsigned *input, unsigned *output, int n, int bytePos) {
    unsigned count[256] = {0};
    // Count frequency of each byte value
    for (int i = 0; i < n; i++) {
        unsigned char byte = (input[i] >> (bytePos * 8)) & 0xFF;
        count[byte]++;
    }

    // Compute cumulative sum
    for (int i = 1; i < 256; i++) {
        count[i] += count[i - 1];
    }

    // Place elements into output array in sorted order
    for (int i = n - 1; i >= 0; i--) {
        unsigned char byte = (input[i] >> (bytePos * 8)) & 0xFF;
        output[count[byte] - 1] = input[i];
        count[byte]--;
    }
}

CompilationN/AN/ACompile ErrorScore: N/A


Judge Duck Online | 评测鸭在线
Server Time: 2025-04-05 23:18:55 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠