提交记录 11195
提交时间 |
评测时间 |
2019-11-05 15:29:41 |
2020-08-01 02:39:55 |
#include<string.h>
void sort(unsigned *a, int n){
unsigned *b = new unsigned [n];
int cnt[4][256];
memset(cnt, 0, sizeof cnt);
for(int i = 0;i < n;++ i){
++ cnt[0][a[i] & 255];
++ cnt[1][(a[i] >> 8) & 255];
++ cnt[2][(a[i] >> 16) & 255];
++ cnt[3][a[i] >> 24];
}
for(int i = 1;i < 256;++ i){
cnt[0][i] += cnt[0][i - 1];
cnt[1][i] += cnt[1][i - 1];
cnt[2][i] += cnt[2][i - 1];
cnt[3][i] += cnt[3][i - 1];
}
for(int i = n - 1;~i;-- i) b[-- cnt[0][a[i] & 255]] = a[i];
for(int i = n - 1;~i;-- i) a[-- cnt[1][(b[i] >> 8) & 255]] = b[i];
for(int i = n - 1;~i;-- i) b[-- cnt[2][(a[i] >> 16) & 255]] = a[i];
for(int i = n - 1;~i;-- i) a[-- cnt[3][b[i] >> 24]] = b[i];
delete [] b;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 807.753 ms | 762 MB + 988 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-11-24 00:25:28 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠