提交记录 31017


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_codex_260812 wc2017b1. 【WC2017】挑战-任务1 Time Limit Exceeded 67 3 s 1305564 KB C 795 B
提交时间 评测时间
2026-08-13 00:58:18 2026-08-13 00:58:55
#define BITMAP_PREFETCH 32
#pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

#define BITMAP_WORDS (1U << 27)
static unsigned bitmap[BITMAP_WORDS] __attribute__((aligned(2097152)));

void sort(unsigned *a, int n) {
    for (int i = 0; i < n; ++i) {
#ifdef BITMAP_PREFETCH
        if (i + BITMAP_PREFETCH < n)
            __builtin_prefetch(bitmap + (a[i + BITMAP_PREFETCH] >> 5), 1, 0);
#endif
        unsigned value = a[i];
        bitmap[value >> 5] |= 1U << (value & 31);
    }
    unsigned output = 0;
    for (unsigned word_index = 0; word_index < BITMAP_WORDS; ++word_index) {
        unsigned bits = bitmap[word_index];
        while (bits) {
            a[output++] = (word_index << 5) + (unsigned)__builtin_ctz(bits);
            bits &= bits - 1;
        }
    }
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1113.024 ms273 MB + 44 KBAcceptedScore: 34

Testcase #22.458 s893 MB + 508 KBAcceptedScore: 33

Testcase #33 s1274 MB + 988 KBTime Limit ExceededScore: 0


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