提交记录 29661
| 提交时间 |
评测时间 |
| 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;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 0 ns | 0 KB | Judge Failed | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-09-12 17:02:41 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠