提交记录 15695
提交时间 |
评测时间 |
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]);
// }
//}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 353.9 us | 344 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:18:22 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠