#pragma GCC optimize("-fdelete-null-pointer-checks,inline-functions-called-once,-funsafe-loop-optimizations,-fexpensive-optimizations,-foptimize-sibling-calls,-ftree-switch-conversion,-finline-small-functions,inline-small-functions,-frerun-cse-after-loop,-fhoist-adjacent-loads,-findirect-inlining,-freorder-functions,no-stack-protector,-fpartial-inlining,-fsched-interblock,-fcse-follow-jumps,-fcse-skip-blocks,-falign-functions,-fstrict-overflow,-fstrict-aliasing,-fschedule-insns2,-ftree-tail-merge,inline-functions,-fschedule-insns,-freorder-blocks,-fwhole-program,-funroll-loops,-fthread-jumps,-fcrossjumping,-fcaller-saves,-fdevirtualize,-falign-labels,-falign-loops,-falign-jumps,unroll-loops,-fsched-spec,-ffast-math,Ofast,inline,-fgcse,-fgcse-lm,-fipa-sra,-ftree-pre,-ftree-vrp,-fpeephole2",3)
#pragma GCC target("avx","sse2")
const int maxn=100000003,d=256;
void sort(unsigned *a,int n){
unsigned p0[d],p1[d],p2[d],p3[d],tp[maxn];
for(unsigned *i=a,*to=a+n;i!=to;i++)p0[*i&255]++,p1[(*i>>8)&255]++,p2[(*i>>16)&255]++,p3[(*i>>24)&255]++;
for(unsigned *i0=p0+1,*i1=p1+1,*i2=p2+1,*i3=p3+1,*to0=p0+d;i0!=to0;i0++,i1++,i2++,i3++)
*i0+=*(i0-1),*i1+=*(i1-1),*i2+=*(i2-1),*i3+=*(i3-1);
for(unsigned *i=a+n-1,*to=a-1;i!=to;i--)tp[--p0[*i&255]]=*i;
for(unsigned *i=tp+n-1,*to=tp-1;i!=to;i--)a[--p1[(*i>>8)&255]]=*i;
for(unsigned *i=a+n-1,*to=a-1;i!=to;i--)tp[--p2[(*i>>16)&255]]=*i;
for(unsigned *i=tp+n-1,*to=tp-1;i!=to;i--)a[--p3[(*i>>24)&255]]=*i;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 790.932 ms | 762 MB + 976 KB | Accepted | Score: 100 | 显示更多 |