#define Inc(i, a, b) for(register int (i) = (a); (i) < (b); ++ (i))
#define Dec(i, a, b) for(register int (i) = (a) - 1; (i) >= (b); -- (i))
void sort(unsigned *a, int n) {
int cnt[4][0x100], b[100000000];
Inc(i, 0, n)
++ cnt[0][(a[i] ) & 0xff],
++ cnt[1][(a[i] >> 8) & 0xff],
++ cnt[2][(a[i] >> 16) & 0xff],
++ cnt[3][(a[i] >> 24) & 0xff];
Inc(i, 1, 0x100)
cnt[0][i] += cnt[0][i - 1],
cnt[1][i] += cnt[1][i - 1],
cnt[2][i] += cnt[2][i - 1],
cnt[3][i] += cnt[3][i - 1];
Dec(i, n, 0)
b[-- cnt[0][(a[i] ) & 0xff]] = a[i];
Dec(i, n, 0)
a[-- cnt[1][(b[i] >> 8) & 0xff]] = b[i];
Dec(i, n, 0)
b[-- cnt[2][(a[i] >> 16) & 0xff]] = a[i];
Dec(i, n, 0)
a[-- cnt[3][b[i] >> 24]] = b[i];
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 809.168 ms | 762 MB + 976 KB | Wrong Answer | Score: 0 | 显示更多 |