提交记录 17775


用户 题目 状态 得分 用时 内存 语言 代码长度
TOBapNw 1001a. 测测你的排序2 Accepted 100 211.98 us 368 KB C++ 576 B
提交时间 评测时间
2022-07-06 09:53:01 2022-07-06 09:53:04
#include <bits/stdc++.h>
namespace Radix_Sort{
const int B=16,M=(1<<B)-1,N=10000,W=32;
unsigned cnt[1<<B],t[N];
inline void radix_sort(unsigned*_begin_iter,unsigned*_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(a, a + n);
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1211.98 us368 KBAcceptedScore: 100


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