提交记录 7083


用户 题目 状态 得分 用时 内存 语言 代码长度
ikka 1001. 测测你的排序 Compile Error 0 0 ns 0 KB C++ 514 B
提交时间 评测时间
2018-12-17 10:18:01 2020-08-01 00:57:56
#include <algorithm>
#include <cstring>



const int maxn = 100010;
const int base = 256;
const int bit = 8;

int b[maxn], cnt[base];

int id(int x, int d) {
  return (x >> bit * d) & (base - 1);
}

void sort(unsigned *a, int n) {
	int *x = a, *y = b;
  for (int d = 0; d < 4; ++d) {
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < n; ++i) ++cnt[id(x[i], d)];
    for (int i = 1; i < base; ++i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; --i) y[--cnt[id(x[i], d)]] = x[i];
    std::swap(x, y);
  }
}

CompilationN/AN/ACompile ErrorScore: N/A


Judge Duck Online | 评测鸭在线
Server Time: 2026-04-09 01:20:20 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠