提交记录 15695


用户 题目 状态 得分 用时 内存 语言 代码长度
yinjun2024 1001a. 测测你的排序2 Accepted 100 353.9 us 344 KB C++ 844 B
提交时间 评测时间
2021-01-25 11:51:54 2021-01-25 11:51:55
#include <algorithm>
//#include <cstdio>
int indx[65536];
int se[10000];
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 #1353.9 us344 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2023-01-30 15:19:36 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用