提交记录 6600


用户 题目 状态 得分 用时 内存 语言 代码长度
FlashHu 1001. 测测你的排序 Accepted 100 833.643 ms 781284 KB C++ 929 B
提交时间 评测时间
2018-10-30 16:13:18 2020-08-01 00:46:31
#include<bits/stdc++.h>
using namespace std;
namespace FlashHu{
#define RG register
#define UC unsigned char
unsigned int b[100000009];
	template<typename T>
	inline void Radixsort(T*fst,T*lst,T*buf,int*op){
		static int b[0x100];
		int Len=lst-fst,Sz=sizeof(T),at=0,i,j;
		RG UC*bgn,*end,tmp;
		for(i=0;i<Sz;++i){
			if(op[i]==-1)continue;
			bgn=(UC*)fst+i;end=(UC*)lst+i;
			tmp=((op[i]&1)?0xff:0)^((op[i]&2)?0x80:0);
			if(tmp)for(RG UC*it=bgn;it!=end;it+=Sz)*it^=tmp;
			memset(b,0,sizeof(b));
			for(RG UC*it=bgn;it!=end;it+=Sz)++b[*it];
			for(j=1;j<=0xff;++j)b[j]+=b[j-1];
			for(RG UC*it=end;it!=bgn;)buf[--b[*(it-=Sz)]]=*--lst;
			lst=buf+Len;swap(fst,buf);at^=1;
			bgn=(UC*)fst+i;end=(UC*)lst+i;
			if(tmp)for(RG UC*it=bgn;it!=end;it+=Sz)*it^=tmp;
		}
		if(at)memcpy(buf,fst,lst-fst);
	}
//#undef RG
//#undef UC
}
using namespace FlashHu;
void sort(unsigned *a, int n) {
	Radixsort(a, a + n,b,new int[4]{0,0,0,0});
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1833.643 ms762 MB + 996 KBAcceptedScore: 100


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