#define ful 255
int t0[ful + 1], t1[ful + 1], t2[ful + 1], t3[ful + 1];
unsigned *b = new unsigned[100000000], *t[ful + 1], *p;
void sort(unsigned *a, int n) {
unsigned int i, x;
for (i = 0; i < n;) {
#define add x = a[i], ++t0[x & ful], ++t1[x >> 8 & ful], ++t2[x >> 16 & ful], ++t3[x >> 24], ++i;
add add add add
#undef add
}
#define sor(a, b, tc, op) \
p = b - 1; \
for (i = 0; i <= ful; i++) t[i] = p, p += tc[i]; \
for (i = 0; i < n; i += 8) { \
p = a + i; \
*(++t[p[0] op]) = p[0]; \
*(++t[p[1] op]) = p[1]; \
*(++t[p[2] op]) = p[2]; \
*(++t[p[3] op]) = p[3]; \
*(++t[p[4] op]) = p[4]; \
*(++t[p[5] op]) = p[5]; \
*(++t[p[6] op]) = p[6]; \
*(++t[p[7] op]) = p[7]; \
}
sor(a, b, t0, & ful);
sor(b, a, t1, >> 8 & ful);
sor(a, b, t2, >> 16 & ful);
sor(b, a, t3, >> 24);
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 786.045 ms | 762 MB + 988 KB | Accepted | Score: 100 | 显示更多 |