提交记录 13246


用户 题目 状态 得分 用时 内存 语言 代码长度
hs_black 1001. 测测你的排序 Accepted 100 823.674 ms 781292 KB C++ 866 B
提交时间 评测时间
2020-08-01 08:53:40 2020-08-01 08:53:45
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <ctime>
#include <algorithm>
#define re register
#pragma GCC optimize(3)
typedef unsigned int u32;
typedef unsigned long long u64;

#define N 256
int cnt[N], cnt1[N], cnt2[N], cnt3[N];
u32 a[200000000], b[200000000];

void sort(unsigned *a, int n) {
	for (re int i = 0;i < n; i++) {
		++cnt[a[i] & 255];
		++cnt1[a[i] >> 8 & 255];
		++cnt2[a[i] >> 16 & 255];
		++cnt3[a[i] >> 24];
	}
	
    for (re int i = 1;i <= 255; ++i) 
    	cnt[i] += cnt[i-1],
    	cnt1[i] += cnt1[i-1],
    	cnt2[i] += cnt2[i-1],
    	cnt3[i] += cnt3[i-1];
    for (re int i = n - 1; ~i; --i) b[--cnt[a[i]&255]] = a[i];
    for (re int i = n - 1; ~i; --i) a[--cnt1[(b[i]>>8)&255]] = b[i];
    for (re int i = n - 1; ~i; --i) b[--cnt2[(a[i]>>16)&255]] = a[i];
    for (re int i = n - 1; ~i; --i) a[--cnt3[b[i]>>24]] = b[i];
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1823.674 ms762 MB + 1004 KBAcceptedScore: 100


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