提交记录 12041
提交时间 |
评测时间 |
2020-03-11 20:56:41 |
2020-08-01 02:50:32 |
#include <string.h>
// 这不是 WC 2017 挑战 的 标程
void sort(unsigned *a, int n){
constexpr int S = 11;
static unsigned _b[100000005], *b;
static unsigned cnt[1<<S];
int i;
b = _b;
for (i = 0; i < 32; i += S) {
for (int j = 0; j < 1<<S; j++) cnt[j] = 0;
if (i + S >= 32) {
for (int j = 0; j < n; j++) ++cnt[a[j] >> i];
for (int j = 1; j < 1 << S; j++) cnt[j] += cnt[j - 1];
for (int j = n - 1; j >= 0; j--) b[--cnt[a[j] >> i]] = a[j];
unsigned *tmp = a;
a = b, b = tmp;
continue;
}
int t = (1 << S) - 1;
for (int j = 0; j < n; j++) ++cnt[(a[j] >> i) & t];
for (int j = 1; j < 1 << S; j++) cnt[j] += cnt[j - 1];
for (int j = n - 1; j >= 0; j--) b[--cnt[(a[j] >> i) & t]] = a[j];
unsigned *tmp = a;
a = b, b = tmp;
}
memcpy(b,a,n*4);
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 1.691 s | 762 MB + 980 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-11-23 23:43:31 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠