// Author: wlzhouzhuan
#pragma GCC optimize(2, 3, "Ofast")
#pragma GCC target("avx", "avx2")
#ifdef xay
#define D(...) fprintf(stderr, "[D]" __VA_ARGS__)
#else
#define D(...) ((void)0)
#endif
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fir first
#define sec second
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, l, r) for (int i = l; i >= r; i--)
#define mset(s, t) memset(s, t, sizeof(s))
#define mcpy(s, t) memcpy(s, t, sizeof(t))
#define poly vector<int>
#define SZ(x) (int(x.size()))
template<typename T1, typename T2> void ckmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> void ckmax(T1 &a, T2 b) { if (a < b) a = b; }
int read() {
int x = 0, f = 0; char ch = getchar();
while (!isdigit(ch)) f |= ch == '-', ch = getchar();
while (isdigit(ch)) x = 10 * x + ch - '0', ch = getchar();
return f ? -x : x;
}
template<typename T> void print(T x) {
if (x < 0) putchar('-'), x = -x;
if (x >= 10) print(x / 10);
putchar(x % 10 + '0');
}
template<typename T> void print(T x, char let) {
print(x), putchar(let);
}
const int N = 200000000;
#define u8 unsigned short
#define u32 unsigned int
#define fastsort(a, b, id) for (i0 = n - 1, i1 = n - 2, i2 = n - 3, i3 = n - 4, i4 = n - 5, i5 = n - 6, i6 = n - 7, i7 = n - 8; ~i0; ) \
b[--S##id[ ((u8*)(a + i0))[id] ]] = a[i0], i0 -= 8, \
b[--S##id[ ((u8*)(a + i1))[id] ]] = a[i1], i1 -= 8, \
b[--S##id[ ((u8*)(a + i2))[id] ]] = a[i2], i2 -= 8, \
b[--S##id[ ((u8*)(a + i3))[id] ]] = a[i3], i3 -= 8, \
b[--S##id[ ((u8*)(a + i4))[id] ]] = a[i4], i4 -= 8, \
b[--S##id[ ((u8*)(a + i5))[id] ]] = a[i5], i5 -= 8, \
b[--S##id[ ((u8*)(a + i6))[id] ]] = a[i6], i6 -= 8, \
b[--S##id[ ((u8*)(a + i7))[id] ]] = a[i7], i7 -= 8;
u32 i, b[N], S0[256], S1[256], S2[256], S3[256];
void sort(u32 *a, int n) {
u32 seed, i0, i1, i2, i3, i4, i5, i6, i7;
u8 *p = (u8*)&seed;
scanf("%u%u", &n, &seed);
for (i = 0; i < n; i++) {
S0[p[0]]++, S1[p[1]]++, S2[p[2]]++, S3[p[3]]++;
}
for (i = 1; i < 256; i++)
S0[i] += S0[i - 1], S1[i] += S1[i - 1], S2[i] += S2[i - 1], S3[i] += S3[i - 1];
fastsort(a, b, 0);
fastsort(b, a, 1);
fastsort(a, b, 2);
fastsort(b, a, 3);
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 338.49 us | 684 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #2 | 182.691 ms | 381 MB + 768 KB | Runtime Error | Score: 0 | 显示更多 |
| Testcase #3 | 365.365 ms | 763 MB + 232 KB | Runtime Error | Score: 0 | 显示更多 |