提交记录 32247
| 提交时间 |
评测时间 |
| 2026-08-14 10:39:12 |
2026-08-14 10:39:17 |
#include <string.h>
typedef unsigned int u32;
static u32 b[200000000];
static u32 cnt[1024];
void sort(unsigned *a, int n) {
u32 *c1 = cnt, *c2 = cnt + 256, *c3 = cnt + 512, *c4 = cnt + 768;
u32 *t = b;
memset(cnt, 0, 1024*4);
for (int i = 0; i < n; i++) { u32 x = a[i]; c1[x&255]++; c2[(x>>8)&255]++; c3[(x>>16)&255]++; c4[x>>24]++; }
for (int j = 1; j < 256; j++) { c1[j]+=c1[j-1]; c2[j]+=c2[j-1]; c3[j]+=c3[j-1]; c4[j]+=c4[j-1]; }
int i;
for (i = n - 1; i >= 0; i--) {
if (i >= 8) __builtin_prefetch(&t[c1[a[i-8] & 255]], 1);
t[--c1[a[i] & 255]] = a[i];
}
for (i = n - 1; i >= 0; i--) {
if (i >= 8) __builtin_prefetch(&a[c2[(t[i-8] >> 8) & 255]], 1);
a[--c2[(t[i] >> 8) & 255]] = t[i];
}
for (i = n - 1; i >= 0; i--) {
if (i >= 8) __builtin_prefetch(&t[c3[(a[i-8] >> 16) & 255]], 1);
t[--c3[(a[i] >> 16) & 255]] = a[i];
}
for (i = n - 1; i >= 0; i--) {
if (i >= 8) __builtin_prefetch(&a[c4[t[i-8] >> 24]], 1);
a[--c4[t[i] >> 24]] = t[i];
}
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 1.016 ms | 812 KB | Accepted | Score: 34 | 显示更多 |
| Testcase #2 | 1.105 s | 762 MB + 992 KB | Accepted | Score: 33 | 显示更多 |
| Testcase #3 | 2.209 s | 1525 MB + 928 KB | Accepted | Score: 33 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-09-12 01:07:36 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠