提交记录 19881


用户 题目 状态 得分 用时 内存 语言 代码长度
lotus_f 1001. 测测你的排序 Accepted 100 861.249 ms 781288 KB C++11 888 B
提交时间 评测时间
2023-08-11 16:43:32 2023-08-11 16:43:38
#include<bits/stdc++.h>
void sort(unsigned *a,int n)
{
	int pow2=8,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);
	int pow22=pow2*2;
	for(int j=0; j<=n-1; ++j) ++cnt[a[j]>>pow22&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]>>pow22&siz-1]]=a[j];
	memset(cnt,0,siz*4);
	int pow23=pow2*3;
	for(int j=0; j<=n-1; ++j) ++cnt[b[j]>>pow23&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]>>pow23&siz-1]]=b[j];
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1861.249 ms762 MB + 1000 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2024-05-07 20:56:21 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用