提交记录 19884


用户 题目 状态 得分 用时 内存 语言 代码长度
lotus_f 1001. 测测你的排序 Accepted 100 1.699 s 781296 KB C++14 855 B
提交时间 评测时间
2023-08-11 16:45:16 2023-08-11 16:45:23
#include<bits/stdc++.h>
void sort(unsigned *a,int n)
{
	int pow2=11,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 #11.699 s762 MB + 1008 KBAcceptedScore: 100


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