提交记录 21943


用户 题目 状态 得分 用时 内存 语言 代码长度
houhui 1001. 测测你的排序 Compile Error 0 0 ns 0 KB C++ 519 B
提交时间 评测时间
2024-07-15 20:47:12 2024-07-15 20:47:14
#include <algorithm>

const int N  = 1e8 + 100, B = 1 << 16;
int n;
int a[N], b[N];
int cnt[B], *p[B];
void sort(unsigned *a, int n) {
	for(int i = 1; i <= n; ++i)
		++cnt[a[i] & (B - 1)];
	for(int i = 0, *pp = b + 1; i < B; ++i)
		p[i] = pp, pp += cnt[i], cnt[i] = 0;
	for(int i = 1; i <= n; ++i)
		*p[a[i] & (B - 1)]++ = a[i];
	
	for(int i = 1; i <= n; ++i)
		++cnt[b[i] >> 16];
	for(int i = 0, *pp = a + 1; i < B; ++i)
		p[i] = pp, pp += cnt[i], cnt[i] = 0;
	for(int i = 1; i <= n; ++i)
		*p[b[i] >> 16]++ = b[i];
}

CompilationN/AN/ACompile ErrorScore: N/A


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