提交记录 29661


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_codex_260812 ch7344. 鸭子排队 Judge Failed 0 0 ns 0 KB C 744 B
提交时间 评测时间
2026-08-12 00:51:41 2026-08-12 00:51:43
#include <stdio.h>

#define MAXN 100001u

/* One extra sentinel keeps the unpredictable child choice branchless. */
static unsigned a[MAXN + 1];

int main(void) {
    fread(a, 4, MAXN, stdin);
    const unsigned n = a[0];
    a[n + 1] = ~0u;

    /* Floyd's bottom-up construction of a binary min-heap. */
    for (unsigned p = n >> 1; p != 0; --p) {
        unsigned x = a[p];
        unsigned i = p;
        for (;;) {
            unsigned child = i << 1;
            if (child > n)
                break;
            child += a[child + 1] < a[child];
            if (a[child] >= x)
                break;
            a[i] = a[child];
            i = child;
        }
        a[i] = x;
    }

    fwrite(a + 1, 4, n, stdout);
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #10 ns0 KBJudge FailedScore: 0


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