提交记录 11195


用户 题目 状态 得分 用时 内存 语言 代码长度
AThousandMoon 1001. 测测你的排序 Accepted 100 807.753 ms 781276 KB C++11 703 B
提交时间 评测时间
2019-11-05 15:29:41 2020-08-01 02:39:55
#include<string.h>
void sort(unsigned *a, int n){
	unsigned *b = new unsigned [n];
	int cnt[4][256];
	memset(cnt, 0, sizeof cnt);
	for(int i = 0;i < n;++ i){
		++ cnt[0][a[i] & 255];
		++ cnt[1][(a[i] >> 8) & 255];
		++ cnt[2][(a[i] >> 16) & 255];
		++ cnt[3][a[i] >> 24];
	}
	for(int i = 1;i < 256;++ i){
		cnt[0][i] += cnt[0][i - 1];
		cnt[1][i] += cnt[1][i - 1];
		cnt[2][i] += cnt[2][i - 1];
		cnt[3][i] += cnt[3][i - 1];
	}
	for(int i = n - 1;~i;-- i) b[-- cnt[0][a[i] & 255]] = a[i];
	for(int i = n - 1;~i;-- i) a[-- cnt[1][(b[i] >> 8) & 255]] = b[i];
	for(int i = n - 1;~i;-- i) b[-- cnt[2][(a[i] >> 16) & 255]] = a[i];
	for(int i = n - 1;~i;-- i) a[-- cnt[3][b[i] >> 24]] = b[i];
	delete [] b;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1807.753 ms762 MB + 988 KBAcceptedScore: 100


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