提交记录 22424


用户 题目 状态 得分 用时 内存 语言 代码长度
yussgrw 1001. 测测你的排序 Accepted 100 818.999 ms 781264 KB C++ 1.17 KB
提交时间 评测时间
2024-08-31 02:08:07 2024-08-31 02:08:12
unsigned b[100000000];
int z0[256], z1[256], z2[256], z3[256];

void sort(unsigned *a, int n) {
  register unsigned char *start = (unsigned char *)a,
                         *startb = (unsigned char *)b;
  register unsigned char *c0 = start, *c1 = start + 1, *c2 = start + 2,
                         *c3 = start + 3;
  for (register int i = n; i; --i) {
    ++z0[*c0];
    ++z1[*c1];
    ++z2[*c2];
    ++z3[*c3];
    c0 += 4;
    c1 += 4;
    c2 += 4;
    c3 += 4;
  }
  for (register int i = 1; i < 256; ++i) {
    z0[i] += z0[i - 1];
    z1[i] += z1[i - 1];
    z2[i] += z2[i - 1];
    z3[i] += z3[i - 1];
  }

  register unsigned *p;

  p = a + n;
  for (register unsigned char *c = (unsigned char *)(a + n) - 4; c >= start;
       c -= 4) {
    b[--z0[*c]] = *(--p);
  }

  p = b + n;
  for (register unsigned char *c = (unsigned char *)(b + n) - 3; c >= startb;
       c -= 4) {
    a[--z1[*c]] = *(--p);
  }

  p = a + n;
  for (register unsigned char *c = (unsigned char *)(a + n) - 2; c >= start;
       c -= 4) {
    b[--z2[*c]] = *(--p);
  }

  p = b + n;
  for (register unsigned char *c = (unsigned char *)(b + n) - 1; c >= startb;
       c -= 4) {
    a[--z3[*c]] = *(--p);
  }
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1818.999 ms762 MB + 976 KBAcceptedScore: 100


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