提交记录 9613
提交时间 |
评测时间 |
2019-06-20 15:30:10 |
2020-08-01 01:41:16 |
#include <string.h>
#include <algorithm>
#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")
void LSD_Radix_Sort(unsigned *a, int n) {
unsigned _b[n];
unsigned *b = _b;
int cnt[256];
for (int i = 0; i < 32; i += 8) {
memset(cnt, 0, sizeof(cnt));
for (int j = 0; j < n; j++) cnt[(a[j] >> i) & 255]++;
for (int j = 1; j < 256; j++) cnt[j] += cnt[j - 1];
for (int j = n - 1; j >= 0; j--) b[--cnt[(a[j] >> i) & 255]] = a[j];
std::swap(a, b);
}
}
void sort(unsigned *a, int n) {
LSD_Radix_Sort(a, n);
}
#pragma GCC pop_options
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 75.51 us | 88 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:43:47 | Loaded in 4 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠