提交记录 17772


用户 题目 状态 得分 用时 内存 语言 代码长度
TOBapNw 1001. 测测你的排序 Accepted 100 2.369 s 781540 KB C++ 600 B
提交时间 评测时间
2022-07-06 09:49:57 2022-07-06 09:50:04
#include <bits/stdc++.h>
namespace Radix_Sort{
const int B=16,M=(1<<B)-1,N=100000000,W=32;
unsigned cnt[1<<B],t[N];
template<typename T=int>inline void radix_sort(T*_begin_iter,T*_end_iter){
	int n=_end_iter-_begin_iter;
	unsigned*b=t;
	for(int i=0;i<W;i+=B){
		for(int j=0;j<=M;j++)cnt[j]=0;
		for(int j=0;j<n;j++)++cnt[(_begin_iter[j]>>i)&M];
		for(int s=0,j=0;j<=M;j++)s+=cnt[j],cnt[j]=s-cnt[j];
		for(int j=0;j<n;j++)b[cnt[(_begin_iter[j]>>i)&M]++]=_begin_iter[j];
		std::swap(_begin_iter,b);
	}
}
}
using Radix_Sort::radix_sort;
void sort(unsigned *a, int n) {
	radix_sort<unsigned>(a, a + n);
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.369 s763 MB + 228 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2024-05-07 18:53:23 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用