提交记录 14817
| 提交时间 |
评测时间 |
| 2020-11-13 09:14:16 |
2020-11-13 09:14:17 |
#include <utility>
#include <cstring>
void sort(unsigned *a, int n) {
unsigned c[n];
unsigned *b = c, pos[256];
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
unsigned *t = b, b = a, a = t;
}
}
| Compilation | N/A | N/A | Compile Error | Score: N/A | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-21 20:59:07 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠