提交记录 17775
提交时间 |
评测时间 |
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);
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 211.98 us | 368 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:06:55 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠