提交记录 398


用户 题目 状态 得分 用时 内存 语言 代码长度
hqztrue 1001. 测测你的排序 Accepted 100 854.246 ms 781260 KB C 1.07 KB
提交时间 评测时间
2018-06-20 13:30:43 2020-07-31 20:38:30
unsigned B[100000005];
unsigned s[255+1];
void radix_sort_(unsigned *A,register int l,register int r){  //a[i]>=0, -O2
	const unsigned base = 255;
	A+=l-1;r-=l-1;l=1;
	register unsigned *a=A,*b=B;
	register int i;
	{
		for (i=0;i<=base;++i)s[i]=0;
		for (i=1;i<=r;++i)++s[a[i]&base];
		for (i=1;i<=base;++i)s[i]+=s[i-1];
		for (i=r;i>=1;--i)b[s[a[i]&base]--]=a[i];
		unsigned *tmp=a;a=b;b=tmp;
	}
	{
		for (i=0;i<=base;++i)s[i]=0;
		for (i=1;i<=r;++i)++s[a[i]>>8&base];
		for (i=1;i<=base;++i)s[i]+=s[i-1];
		for (i=r;i>=1;--i)b[s[a[i]>>8&base]--]=a[i];
		unsigned *tmp=a;a=b;b=tmp;
	}
	{
		for (i=0;i<=base;++i)s[i]=0;
		for (i=1;i<=r;++i)++s[a[i]>>16&base];
		for (i=1;i<=base;++i)s[i]+=s[i-1];
		for (i=r;i>=1;--i)b[s[a[i]>>16&base]--]=a[i];
		unsigned *tmp=a;a=b;b=tmp;
	}
	{
		for (i=0;i<=base;++i)s[i]=0;
		for (i=1;i<=r;++i)++s[a[i]>>24&base];
		for (i=1;i<=base;++i)s[i]+=s[i-1];
		for (i=r;i>=1;--i)b[s[a[i]>>24&base]--]=a[i];
		unsigned *tmp=a;a=b;b=tmp;
	}
	//if (a!=A)for (register int i=1;i<=r;++i)A[i]=a[i];
}

void sort(unsigned *a, register int n){
	radix_sort_(a, 0, n-1);
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1854.246 ms762 MB + 972 KBAcceptedScore: 100


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