提交记录 17770
| 提交时间 |
评测时间 |
| 2022-07-06 09:44:13 |
2022-07-06 09:44:14 |
#include <algorithm>
namespace Radix_Sort{
const int B=16,M=(1<<B)-1,N=100000000,W=32;
int 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;
int*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];
swap(_begin_iter,b);
}
}
}
using Radix_Sort::radix_sort;
void sort(unsigned *a, int n) {
radix_sort<unsigned>(a, a + n);
}
| Compilation | N/A | N/A | Compile Error | Score: N/A | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-03-17 00:45:46 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠