提交记录 15680


用户 题目 状态 得分 用时 内存 语言 代码长度
yinjun2024 1001. 测测你的排序 Accepted 100 2.561 s 781516 KB C++ 848 B
提交时间 评测时间
2021-01-25 10:24:02 2021-01-25 10:24:08
#include <algorithm>
//#include <cstdio>
int indx[65536];
int se[100000000];
void sort(unsigned *a, int n) {
	for (int i = 0; i < n; i++) {
		indx[a[i] & 0xffff]++;
	}
	for (int i = 1; i < 65536; i++) {
		indx[i] += indx[i - 1];
	}
	for (int i = n - 1; ~i; i--) {
		int sf = a[i] & 0xffff;
		se[--indx[sf]] = a[i];
	}
	for (int i = 0; i < n; i++) {
		a[i] = se[i];
	}
	for (int i = 0; i < 65536; i++) {
		indx[i] = 0;
	}
	for (int i = 0; i < n; i++) {
		indx[a[i] >> 16]++;
	}
	for (int i = 1; i < 65536; i++) {
		indx[i] += indx[i - 1];
	}
	for (int i = n - 1; ~i; i--) {
		int sf = a[i] >> 16;
		se[--indx[sf]] = a[i];
	}
	for (int i = 0; i < n; i++) {
		a[i] = se[i];
	}
}
//O(\sum{Index}+\tot{Index}*n)
//int main() {
//	unsigned soe[] = {142, 362, 62, 436};
//	sort(soe, 4);
//	for (int i = 0; i < 4; i++) {
//		printf("%u ", soe[i]);
//	}
//}

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.561 s763 MB + 204 KBAcceptedScore: 100


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