提交记录 12930
提交时间 |
评测时间 |
2020-07-04 23:16:07 |
2020-08-01 03:01:39 |
void sort(unsigned *a, int len) {
unsigned *b = new unsigned[len]/*malloc(sizeof(unsigned) * len)*/;
int sum[256] = {0}, sum1[256] = {0}, sum2[256] = {0}, sum3[256] = {0};
for (int i = 0; i < len; i++) {
++sum[a[i] & 255];
++sum1[(a[i] >> 8) & 255];
++sum2[(a[i] >> 16) & 255];
++sum3[a[i] >> 24];
}
for (int q = 1; q <= 255; ++q) {
sum[q] += sum[q - 1];
sum1[q] += sum1[q - 1];
sum2[q] += sum2[q - 1];
sum3[q] += sum3[q - 1];
}
for (int q = len - 1; q >= 0; --q) b[--sum[a[q] & 255]] = a[q];
for (int q = len - 1; q >= 0; --q) a[--sum1[(b[q] >> 8) & 255]] = b[q];
for (int q = len - 1; q >= 0; --q) b[--sum2[(a[q] >> 16) & 255]] = a[q];
for (int q = len - 1; q >= 0; --q) a[--sum3[b[q] >> 24]] = b[q];
// free(b);
delete b;
return;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 72.12 us | 100 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:40:32 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠