提交记录 14815
用户 |
题目 |
状态 |
得分 |
用时 |
内存 |
语言 |
代码长度 |
Exr0n |
1001. 测测你的排序 |
Accepted |
100 |
979.829 ms |
781260 KB |
C++11 |
482 B |
提交时间 |
评测时间 |
2020-11-13 09:09:56 |
2020-11-13 09:10:01 |
#include <utility>
#include <cstring>
void sort(unsigned *a, int n) {
unsigned c[n+5];
unsigned *b = c, pos[300];
for (unsigned s=0; s<32; s+=8)
{
memset(pos, 0, sizeof pos); // FIX: clears-- pos
for (int i=0; i<n; ++i) ++pos[a[i]>>s&0xff];
for (int i=1; i<256; ++i) pos[i] += pos[i-1];
for (int i=n-1; ~i; --i) b[--pos[a[i]>>s&0xff]] = a[i]; // FIX: bounds--start at n-1 not at n cuz zero index smah
std::swap(a, b);
}
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 979.829 ms | 762 MB + 972 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-11-24 00:01:07 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠