提交记录 8556


用户 题目 状态 得分 用时 内存 语言 代码长度
MashPlant 1001. 测测你的排序 Runtime Error 0 228.872 ms 390632 KB C++ 1.06 KB
提交时间 评测时间
2019-02-25 13:42:48 2020-08-01 01:21:10
#include <cstring>
const unsigned N = 1e8 + 5;
unsigned aux[N];

void sort(unsigned *a, int n) {
  const unsigned U = 256;
  unsigned cnt[U];
  memset(cnt, 0, sizeof cnt);
  for (unsigned i = 0; i < n; ++i)
    ++cnt[a[i] & U - 1];
  for (unsigned i = 1; i < U; ++i)
    cnt[i] += cnt[i - 1];
  for (unsigned i = n - 1; i >= 0; --i)
    aux[--cnt[a[i] & U - 1]] = a[i];
  memset(cnt, 0, sizeof cnt);
  for (unsigned i = 0; i < n; ++i)
    ++cnt[aux[i] >> 8 & U - 1];
  for (unsigned i = 1; i < U; ++i)
    cnt[i] += cnt[i - 1];
  for (unsigned i = n - 1; i >= 0; --i)
    a[--cnt[aux[i] >> 8 & U - 1]] = aux[i];
  memset(cnt, 0, sizeof cnt);
  for (unsigned i = 0; i < n; ++i)
    ++cnt[a[i] >> 16 & U - 1];
  for (unsigned i = 1; i < U; ++i)
    cnt[i] += cnt[i - 1];
  for (unsigned i = n - 1; i >= 0; --i)
    aux[--cnt[a[i] >> 16 & U - 1]] = a[i];
  memset(cnt, 0, sizeof cnt);
  for (unsigned i = 0; i < n; ++i)
    ++cnt[aux[i] >> 24];
  for (unsigned i = 1; i < U; ++i)
    cnt[i] += cnt[i - 1];
  for (unsigned i = n - 1; i >= 0; --i)
    a[--cnt[aux[i] >> 24]] = aux[i];
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1228.872 ms381 MB + 488 KBRuntime ErrorScore: 0


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