#include<bits/stdc++.h>
using namespace std;
namespace FlashHu{
#define RG register
#define UC unsigned char
unsigned int b[100000009];
template<typename T>
inline void Radixsort(T*fst,T*lst,T*buf,int*op){
static int b[0x100];
int Len=lst-fst,Sz=sizeof(T),at=0,i,j;
RG UC*bgn,*end,tmp;
for(i=0;i<Sz;++i){
if(op[i]==-1)continue;
bgn=(UC*)fst+i;end=(UC*)lst+i;
tmp=((op[i]&1)?0xff:0)^((op[i]&2)?0x80:0);
if(tmp)for(RG UC*it=bgn;it!=end;it+=Sz)*it^=tmp;
memset(b,0,sizeof(b));
for(RG UC*it=bgn;it!=end;it+=Sz)++b[*it];
for(j=1;j<=0xff;++j)b[j]+=b[j-1];
for(RG UC*it=end;it!=bgn;)buf[--b[*(it-=Sz)]]=*--lst;
lst=buf+Len;swap(fst,buf);at^=1;
bgn=(UC*)fst+i;end=(UC*)lst+i;
if(tmp)for(RG UC*it=bgn;it!=end;it+=Sz)*it^=tmp;
}
if(at)memcpy(buf,fst,lst-fst);
}
//#undef RG
//#undef UC
}
using namespace FlashHu;
void sort(unsigned *a, int n) {
Radixsort(a, a + n,b,new int[4]{0,0,0,0});
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 833.643 ms | 762 MB + 996 KB | Accepted | Score: 100 | 显示更多 |