提交记录 9446


用户 题目 状态 得分 用时 内存 语言 代码长度
Izumi_Sagiri 1001. 测测你的排序 Wrong Answer 0 877.512 ms 781276 KB C++ 1.37 KB
提交时间 评测时间
2019-05-11 14:40:31 2020-08-01 01:38:14
void sort(unsigned *a, int n) {
	unsigned *cnt1=new unsigned[257], *cnt2=new unsigned[257], *cnt3=new unsigned[257], *cnt4=new unsigned[257], *tmp=new unsigned[100000001];
    register unsigned *ae = a + n + 1, *tmpe = tmp + n + 1;
    register unsigned *cnte1 = cnt1 + 257, *cnte2 = cnt2 + 257, *cnte3 = cnt3 + 257, *cnte4 = cnt4 + 257;

    for(register unsigned *i = a + 1; i != ae; ++i)
        ++cnt1[*i & 0xff];
    for(register unsigned *i = cnt1 + 1; i != cnte1; ++i)
        *i += *(i - 1);
    for(register unsigned *i = ae - 1; i != a; --i)
        tmp[cnt1[*i & 0xff]--] = *i;

    for(register unsigned *i = tmp + 1; i != tmpe; ++i)
        ++cnt2[(*i >> 8) & 0xff];
    for(register unsigned *i = cnt2 + 1; i != cnte2; ++i)
        *i += *(i - 1);
    for(register unsigned *i = tmpe - 1; i != tmp; --i)
        a[cnt2[(*i >> 8) & 0xff]--] = *i;

    for(register unsigned *i = a + 1; i != ae; ++i)
        ++cnt3[(*i >> 16) & 0xff];
    for(register unsigned *i = cnt3 + 1; i != cnte3; ++i)
        *i += *(i - 1);
    for(register unsigned *i = ae - 1; i != a; --i)
        tmp[cnt3[(*i >> 16) & 0xff]--] = *i;

    for(register unsigned *i = tmp + 1; i != tmpe; ++i)
        ++cnt4[(*i >> 24) & 0xff];
    for(register unsigned *i = cnt4 + 1; i != cnte4; ++i)
        *i += *(i - 1);
    for(register unsigned *i = tmpe - 1; i != tmp; --i)
        a[cnt4[(*i >> 24) & 0xff]--] = *i;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1877.512 ms762 MB + 988 KBWrong AnswerScore: 0


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