提交记录 899


用户 题目 状态 得分 用时 内存 语言 代码长度
orbitingfIea 1001. 测测你的排序 Compile Error 0 0 ns 0 KB C 896 B
提交时间 评测时间
2018-06-20 17:39:31 2020-07-31 20:44:09
#include<stdio.h>


unsigned b[100000000], c0[256], c1[256], c2[256], c3[256];
unsigned *pos[256];

#define gao(cnt,op) \
		pos[0]=B+cnt[0];\
		for (i=1;i<256;++i) cnt[i]+=cnt[i-1], pos[i]=B+cnt[i];\
		for (i=n-1;~i;--i){\
			*(--pos[A[i] op])=A[i];\
		}\
		T=A; A=B; B=T;

void songsongsong(unsigned *a,unsigned n){
	{
		register unsigned i;
		for (i=0;i<n;++i){
			++c0[a[i]&255];
			++c1[a[i]>>8&255];
			++c2[a[i]>>16&255];
			++c3[a[i]>>24&255];
		}
	}
	
	unsigned *A=a, *B=b, *T;
	
	{
		register unsigned i;
		gao(c0,&255);
	}
	{
		register unsigned i;
		gao(c1,>>8&255);
	}
	{
		register unsigned i;
		gao(c2,>>16&255);
	}
	{
		register unsigned i;
		gao(c3,>>24&255);
	}
}

void sort(unsigned *a, int n)
{
	songsongsong(a,n);
}

unsigned a[100000000];
int main(){
	int n;
	scanf("%d",&n);
	int i;
	for (i=0;i<n;++i) scanf("%u",&a[i]);
	sort(a,n);
	for (i=0;i<n;++i) printf("%u ",a[i]);
}

CompilationN/AN/ACompile ErrorScore: N/A


Judge Duck Online | 评测鸭在线
Server Time: 2026-04-25 20:03:36 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠