提交记录 19887


用户 题目 状态 得分 用时 内存 语言 代码长度
lotus_f 1001. 测测你的排序 Accepted 100 2.565 s 781320 KB C++14 855 B
提交时间 评测时间
2023-08-11 16:46:16 2023-08-11 16:46:23
#include<bits/stdc++.h>
void sort(unsigned *a,int n)
{
	int pow2=13,siz=1<<pow2;
	unsigned *b=new unsigned[n],*cnt=new unsigned[siz];
	memset(cnt,0,siz*4);
	for(int j=0; j<=n-1; ++j) ++cnt[a[j]&siz-1];
	for(int j=1; j<=siz-1; ++j) cnt[j]+=cnt[j-1];
	for(int j=n-1; j>=0; --j) b[--cnt[a[j]&siz-1]]=a[j];
	memset(cnt,0,siz*4);
	for(int j=0; j<=n-1; ++j) ++cnt[b[j]>>pow2&siz-1];
	for(int j=1; j<=siz-1; ++j) cnt[j]+=cnt[j-1];
	for(int j=n-1; j>=0; --j) a[--cnt[b[j]>>pow2&siz-1]]=b[j];
	memset(cnt,0,siz*4);
	for(int j=0; j<=n-1; ++j) ++cnt[a[j]>>pow2*2&siz-1];
	for(int j=1; j<=siz-1; ++j) cnt[j]+=cnt[j-1];
	for(int j=n-1; j>=0; --j) b[--cnt[a[j]>>pow2*2&siz-1]]=a[j];
	memset(cnt,0,siz*4);
	for(int j=0; j<=n-1; ++j) ++cnt[b[j]>>pow2*3&siz-1];
	for(int j=1; j<=siz-1; ++j) cnt[j]+=cnt[j-1];
	for(int j=n-1; j>=0; --j) a[--cnt[b[j]>>pow2*3&siz-1]]=b[j];
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.565 s763 MB + 8 KBAcceptedScore: 100


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