提交记录 15680
提交时间 |
评测时间 |
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]);
// }
//}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 2.561 s | 763 MB + 204 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-11-23 23:56:37 | Loaded in 4 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠