inline void swp(unsigned *x,unsigned *y){
unsigned p=*x;
*x=*y;
*y=p;
}
void sort(unsigned *a, int n){
unsigned *end=a+n,*end_=end-1;
//a[n]=0x7f7f7f7f;
//a[n+1]=0x7f7f7f7f;
//a[n+2]=0x7f7f7f7f;
//a[n+3]=0x7f7f7f7f;
//a[n+4]=0x7f7f7f7f;
//a[n+5]=0x7f7f7f7f;
//a[n+6]=0x7f7f7f7f;
for(register int i=0;i<=n;i+=2){
for(register unsigned *j=a;j<end;j+=6){
if(*j>*(j+1)&&(j+1)<end_)swp(j,j+1);
if(*(j+1)>*(j+2)&&(j+2)<end)swp(j+1,j+2);
if(*(j+2)>*(j+3)&&(j+3)<end)swp(j+2,j+3);
if(*(j+3)>*(j+4)&&(j+4)<end)swp(j+3,j+4);
if(*(j+4)>*(j+5)&&(j+5)<end)swp(j+4,j+5);
if(*(j+5)>*(j+6)&&(j+6)<end)swp(j+5,j+6);
}
for(register unsigned *j=a;j<end;j+=6){
if(*j>*(j+1)&&(j+1)<end_)swp(j,j+1);
if(*(j+1)>*(j+2)&&(j+2)<end)swp(j+1,j+2);
if(*(j+2)>*(j+3)&&(j+3)<end)swp(j+2,j+3);
if(*(j+3)>*(j+4)&&(j+4)<end)swp(j+3,j+4);
if(*(j+4)>*(j+5)&&(j+5)<end)swp(j+4,j+5);
if(*(j+5)>*(j+6)&&(j+6)<end)swp(j+5,j+6);
}
/*for(register int *j=a+i;j<end_;j+=6){
if(*j>*(j+1))swp(j,j+1);
if(*(j+1)>*(j+2))swp(j+1,j+2);
if(*(j+2)>*(j+3))swp(j+2,j+3);
if(*(j+3)>*(j+4))swp(j+3,j+4);
if(*(j+4)>*(j+5))swp(j+4,j+5);
if(*(j+5)>*(j+6))swp(j+5,j+6);
}*/
}
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 125.087 ms | 48 KB | Accepted | Score: 100 | 显示更多 |