unsigned * limit,* key,buffer0[256],buffer8[256],buffer16[256],buffer24[256],b[100000000];
void sort(unsigned * a,int n)
{
for (limit = a + n - 7,key = a;key < limit;++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key,++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key,++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key,++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key,++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key,++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key,++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key,++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key);
switch (a + n - key)
{
case 7:
++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key;
case 6:
++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key;
case 5:
++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key;
case 4:
++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key;
case 3:
++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key;
case 2:
++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key;
case 1:
++ buffer0[* key & 255],++ buffer8[* key >> 8 & 255],++ buffer16[* key >> 16 & 255],++ buffer24[* key >> 24 & 255],++ key;
}
for (limit = buffer0 + 255,key = buffer0;key < limit;* key += * key ++);
for (limit = a + 7,key = a + n - 1;key >= limit;b[-- buffer0[* key & 255]] = * key,-- key,b[-- buffer0[* key & 255]] = * key,-- key,b[-- buffer0[* key & 255]] = * key,-- key,b[-- buffer0[* key & 255]] = * key,-- key,b[-- buffer0[* key & 255]] = * key,-- key,b[-- buffer0[* key & 255]] = * key,-- key,b[-- buffer0[* key & 255]] = * key,-- key,b[-- buffer0[* key & 255]] = * key,-- key);
switch (key - a)
{
case 6:
b[-- buffer0[* key & 255]] = * key,-- key;
case 5:
b[-- buffer0[* key & 255]] = * key,-- key;
case 4:
b[-- buffer0[* key & 255]] = * key,-- key;
case 3:
b[-- buffer0[* key & 255]] = * key,-- key;
case 2:
b[-- buffer0[* key & 255]] = * key,-- key;
case 1:
b[-- buffer0[* key & 255]] = * key,-- key;
case 0:
b[-- buffer0[* key & 255]] = * key,-- key;
}
for (limit = buffer8 + 255,key = buffer8;key < limit;* key += * key ++);
for (limit = b + 7,key = b + n - 1;key >= limit;a[-- buffer8[* key >> 8 & 255]] = * key,-- key,a[-- buffer8[* key >> 8 & 255]] = * key,-- key,a[-- buffer8[* key >> 8 & 255]] = * key,-- key,a[-- buffer8[* key >> 8 & 255]] = * key,-- key,a[-- buffer8[* key >> 8 & 255]] = * key,-- key,a[-- buffer8[* key >> 8 & 255]] = * key,-- key,a[-- buffer8[* key >> 8 & 255]] = * key,-- key,a[-- buffer8[* key >> 8 & 255]] = * key,-- key);
switch (key - b)
{
case 6:
a[-- buffer8[* key >> 8 & 255]] = * key,-- key;
case 5:
a[-- buffer8[* key >> 8 & 255]] = * key,-- key;
case 4:
a[-- buffer8[* key >> 8 & 255]] = * key,-- key;
case 3:
a[-- buffer8[* key >> 8 & 255]] = * key,-- key;
case 2:
a[-- buffer8[* key >> 8 & 255]] = * key,-- key;
case 1:
a[-- buffer8[* key >> 8 & 255]] = * key,-- key;
case 0:
a[-- buffer8[* key >> 8 & 255]] = * key,-- key;
}
for (limit = buffer16 + 255,key = buffer16;key < limit;* key += * key ++);
for (limit = a + 7,key = a + n - 1;key >= limit;b[-- buffer16[* key >> 16 & 255]] = * key,-- key,b[-- buffer16[* key >> 16 & 255]] = * key,-- key,b[-- buffer16[* key >> 16 & 255]] = * key,-- key,b[-- buffer16[* key >> 16 & 255]] = * key,-- key,b[-- buffer16[* key >> 16 & 255]] = * key,-- key,b[-- buffer16[* key >> 16 & 255]] = * key,-- key,b[-- buffer16[* key >> 16 & 255]] = * key,-- key,b[-- buffer16[* key >> 16 & 255]] = * key,-- key);
switch (key - a)
{
case 6:
b[-- buffer16[* key >> 16 & 255]] = * key,-- key;
case 5:
b[-- buffer16[* key >> 16 & 255]] = * key,-- key;
case 4:
b[-- buffer16[* key >> 16 & 255]] = * key,-- key;
case 3:
b[-- buffer16[* key >> 16 & 255]] = * key,-- key;
case 2:
b[-- buffer16[* key >> 16 & 255]] = * key,-- key;
case 1:
b[-- buffer16[* key >> 16 & 255]] = * key,-- key;
case 0:
b[-- buffer16[* key >> 16 & 255]] = * key,-- key;
}
for (limit = buffer24 + 255,key = buffer24;key < limit;* key += * key ++);
for (limit = b + 7,key = b + n - 1;key >= limit;a[-- buffer24[* key >> 24 & 255]] = * key,-- key,a[-- buffer24[* key >> 24 & 255]] = * key,-- key,a[-- buffer24[* key >> 24 & 255]] = * key,-- key,a[-- buffer24[* key >> 24 & 255]] = * key,-- key,a[-- buffer24[* key >> 24 & 255]] = * key,-- key,a[-- buffer24[* key >> 24 & 255]] = * key,-- key,a[-- buffer24[* key >> 24 & 255]] = * key,-- key,a[-- buffer24[* key >> 24 & 255]] = * key,-- key);
switch (key - b)
{
case 6:
a[-- buffer24[* key >> 24 & 255]] = * key,-- key;
case 5:
a[-- buffer24[* key >> 24 & 255]] = * key,-- key;
case 4:
a[-- buffer24[* key >> 24 & 255]] = * key,-- key;
case 3:
a[-- buffer24[* key >> 24 & 255]] = * key,-- key;
case 2:
a[-- buffer24[* key >> 24 & 255]] = * key,-- key;
case 1:
a[-- buffer24[* key >> 24 & 255]] = * key,-- key;
case 0:
a[-- buffer24[* key >> 24 & 255]] = * key,-- key;
}
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 811.022 ms | 762 MB + 976 KB | Accepted | Score: 100 | 显示更多 |