提交记录 28079
提交时间 |
评测时间 |
2025-04-28 12:14:12 |
2025-04-28 12:14:19 |
#include <string.h>
#include <algorithm>
unsigned *b;
unsigned buc[3][2048];
void sort(unsigned *a, int n)
{
b = new unsigned[n];
for (int i = 0; i < n; ++i)
{
++buc[0][a[i] & 2047];
++buc[1][(a[i] >> 11) & 2047];
++buc[2][a[i] >> 22];
}
for (unsigned k = 0; k < 3; ++k)
{
unsigned offset = 0, lim = (k == 2) ? 1024 : 2048;
for (unsigned i = 0; i < lim; ++i)
std::swap(buc[k][i], offset), offset += buc[k][i];
}
for (unsigned i = 0; i < n; ++i) b[buc[0][a[i] & 2047]++] = a[i];
for (unsigned i = 0; i < n; ++i) a[buc[1][(b[i] >> 11) & 2047]++] = b[i];
for (unsigned i = 0; i < n; ++i) b[buc[2][a[i] >> 22]++] = a[i];
memcpy(a, b, n << 2);
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 2.22 s | 1024 MB + 40 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2025-05-14 07:45:56 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠