提交记录 13770


用户 题目 状态 得分 用时 内存 语言 代码长度
return20071007 wc2017b1. 【WC2017】挑战-任务1 Accepted 100 2.296 s 1562528 KB C++ 1.16 KB
提交时间 评测时间
2020-08-09 21:03:03 2020-08-09 21:03:08
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast", 3, "inline")
typedef unsigned int u32;
void sort(unsigned *a, int n) {
    u32 cnt[256];
    u32 *b = new u32[n];
    u32 ps = 0;
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < n; ++i) ++cnt[(a[i] >> ps) & 0xff];
    for (int i = 1; i < 256; ++i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; --i) b[--cnt[(a[i] >> ps) & 0xff]] = a[i];
    std::swap(a, b);
    ps = 8;
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < n; ++i) ++cnt[(a[i] >> ps) & 0xff];
    for (int i = 1; i < 256; ++i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; --i) b[--cnt[(a[i] >> ps) & 0xff]] = a[i];
    std::swap(a, b);
    ps = 16;
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < n; ++i) ++cnt[(a[i] >> ps) & 0xff];
    for (int i = 1; i < 256; ++i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; --i) b[--cnt[(a[i] >> ps) & 0xff]] = a[i];
    std::swap(a, b);
    ps = 24;
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < n; ++i) ++cnt[(a[i] >> ps) & 0xff];
    for (int i = 1; i < 256; ++i) cnt[i] += cnt[i - 1];
    for (int i = n - 1; ~i; --i) b[--cnt[(a[i] >> ps) & 0xff]] = a[i];
    std::swap(a, b);
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #11.064 ms808 KBAcceptedScore: 34

Testcase #21.147 s762 MB + 992 KBAcceptedScore: 33

Testcase #32.296 s1525 MB + 928 KBAcceptedScore: 33


Judge Duck Online | 评测鸭在线
Server Time: 2024-04-26 04:34:37 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用