提交记录 20759


用户 题目 状态 得分 用时 内存 语言 代码长度
lotus_f 1001c. 测测你的排序4 Accepted 100 16.235 s 1048612 KB C++14 888 B
提交时间 评测时间
2023-12-29 21:06:30 2023-12-29 21:06:52
#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 #116.235 s1024 MB + 36 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2024-05-02 16:04:37 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用