#include<bits/stdc++.h>
#define For(i,l,r) for(int i=l,i##_e=r;i<=i##_e;++i)
#define rFor(i,r,l) for(int i=r,i##_e=l;i>=i##_e;--i)
#define y0 y_zero
#define y1 y_one
#define all(a) a.begin(),a.end()
#define cmin(a,b) a=min<remove_reference<decltype(a)>::type>(a,b)
#define cmax(a,b) a=max<remove_reference<decltype(a)>::type>(a,b)
#define vect basic_string
// #define ensure(_) ((_) || (__builtin_unreachable(),0))
using namespace std;
using u32=unsigned;
using i64=long long;
using ll=long long;
using u64=unsigned long long;
using ull=unsigned long long;
#if __SIZEOF_POINTER__==8
using i128=__int128;
using u128=__uint128_t;
#endif
using pii=array<int,2>;
using pll=array<ll,2>;
using a3=array<int,3>;
using a4=array<int,4>;
using a5=array<int,5>;
#define mtc() int T; cin>>T; while(T--) work();
template<class T> void bsort(T *a,const int n) {
static constexpr int l=sizeof(T);
static u32 h[l][256]; T *b=new T[n];
memset(h,0,sizeof(h));
auto _s=[&](T *a,T *b,int k) {
For(i,0,n-1) ++h[a[i]>>k&255];
For(i,1,255) h[i]+=h[i-1];
};
For(i,0,n-1) For(j,0,l-1) ++h[j][a[i]>>(j*8)&255];
For(i,0,l-1) For(j,1,S-1) h[i][j]+=h[i][j-1];
For(i,0,l/2-1) {
rFor(i,n-1,0) b[--h[a[i]>>(i*16)&255]]=a[i];
rFor(i,n-1,0) a[--h[b[i]>>(i*16+8)&255]]=b[i];
}
delete[] b;
}
void sort(u32 *a,int n) {
bsort(a,n);
}
Compilation | N/A | N/A | Compile Error | Score: N/A | 显示更多 |