提交记录 15573


用户 题目 状态 得分 用时 内存 语言 代码长度
wawcac wc2017b1. 【WC2017】挑战-任务1 Accepted 100 2.157 s 1562524 KB C++ 741 B
提交时间 评测时间
2021-01-02 00:18:17 2021-01-02 00:18:20
void sort(unsigned *a,int n)
{
	unsigned *b=new unsigned[n];
	unsigned cnt0[256],cnt8[256],cnt16[256],cnt24[256];
	
	for(int i=0;i<256;i++){
		cnt0[i]=0;
		cnt8[i]=0;
		cnt16[i]=0;
		cnt24[i]=0;
	}
	for(int i=0;i<n;++i){
		++cnt0[a[i]>>0&255];
		++cnt8[a[i]>>8&255];
		++cnt16[a[i]>>16&255];
		++cnt24[a[i]>>24&255];
	}
	for(int i=1;i<=255;++i){
		cnt0[i]+=cnt0[i-1];
		cnt8[i]+=cnt8[i-1];
		cnt16[i]+=cnt16[i-1];
		cnt24[i]+=cnt24[i-1];
	}

#define countingSort(a,b,k) \
for(int i=n-1;i>=0;i-=4){\
	b[--cnt##k[a[i-0]>>k&255]]=a[i-0];\
	b[--cnt##k[a[i-1]>>k&255]]=a[i-1];\
	b[--cnt##k[a[i-2]>>k&255]]=a[i-2];\
	b[--cnt##k[a[i-3]>>k&255]]=a[i-3];\
}

	countingSort(a,b,0);
	countingSort(b,a,8);
	countingSort(a,b,16);
	countingSort(b,a,24);
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1983.39 us804 KBAcceptedScore: 34

Testcase #21.078 s762 MB + 988 KBAcceptedScore: 33

Testcase #32.157 s1525 MB + 924 KBAcceptedScore: 33


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