提交记录 21956


用户 题目 状态 得分 用时 内存 语言 代码长度
houhui 1001c. 测测你的排序4 Accepted 100 16.345 s 1048588 KB C++ 632 B
提交时间 评测时间
2024-07-15 21:13:17 2024-07-15 21:13:38
#include <algorithm>

const unsigned N  = (1 << 27) + 10, LB = 8, B = 1 << LB;
unsigned b[N];
unsigned cnt[B], *p[B], *pp;
void sort(unsigned *a, int n) {
--a;
	for(int k = 0; k < 32; k += LB) {
		for(int i = 1; i <= n; ++i)
			++cnt[a[i] >> k & (B - 1)];
		pp = b + 1;
		for(int i = 0; i < B; ++i)
			p[i] = pp, pp += cnt[i], cnt[i] = 0;
		for(int i = 1; i <= n; ++i)
			*p[a[i] >> k & (B - 1)]++ = a[i];
		k += LB;
		for(int i = 1; i <= n; ++i)
			++cnt[b[i] >> k & (B - 1)];
		pp = a + 1;
		for(int i = 0; i < B; ++i)
			p[i] = pp, pp += cnt[i], cnt[i] = 0;
		for(int i = 1; i <= n; ++i)
			*p[b[i] >> k & (B - 1)]++ = b[i];
	}
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #116.345 s1024 MB + 12 KBAcceptedScore: 100


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