提交记录 5463


用户 题目 状态 得分 用时 内存 语言 代码长度
yirannn 1001. 测测你的排序 Compile Error 0 0 ns 0 KB C++ 1.42 KB
提交时间 评测时间
2018-08-23 15:16:30 2020-08-01 00:17:31
#include <cstring>
#include <cstdio>
#include <cctype>
#define N 100000000
#define mod 255
#define R register
#define O2 __attribute__((optimize("-O2")))
O2 char nc()
{
    static char buf[100000],*p1,*p2;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
O2 int read()
{
    int x=0;char a=nc();
    while(!isdigit(a))a=nc();
    while(isdigit(a))x=(x<<3)+(x<<1)+a-'0',a=nc();
    return x;
}
char pbuf[100000000] , *pp = pbuf;
O2 inline void write(int x)
{
    static int sta[35];
    R int top = 0;
    if(!x)sta[++top]=0;
    while(x) sta[++top] = x % 10 , x /= 10;
    while(top) *pp ++ = sta[top -- ] ^ '0';
}
unsigned int n,a[N],b[N];
O2 int main()
{
    n=read();
    R unsigned int i,*j,*lim;
    unsigned int b1[mod+10],b2[mod+10],b3[mod+10],b4[mod+10];
    memset(b1,0,sizeof b1);
    memset(b2,0,sizeof b2);
    memset(b3,0,sizeof b3);
    memset(b4,0,sizeof b4);
    for(i=1;i<=n;++i)a[i]=read();
    R unsigned int tmp;
    for(j=a+1,lim=a+n+1;j!=lim;++j)++b1[(tmp=(*j))&mod],++b2[(tmp>>8)&mod],++b3[(tmp>>16)&mod],++b4[tmp>>24];
    for(i=1;i<=mod;++i)b1[i]+=b1[i-1],b2[i]+=b2[i-1],b3[i]+=b3[i-1],b4[i]+=b4[i-1];
    for(j=a+n;j!=a;--j)b[b1[(*j)&mod]--]=*j;
    for(j=b+n;j!=b;--j)a[b2[((*j)>>8)&mod]--]=*j;
    for(j=a+n;j!=a;--j)b[b3[((*j)>>16)&mod]--]=*j;
    for(j=b+n;j!=b;--j)a[b4[(*j)>>24]--]=*j;
    for(i=1;i<=n;++i)write(a[i]),*pp ++ = '\n';
    fwrite(pbuf , 1 , pp - pbuf , stdout);
    return 0;
}

CompilationN/AN/ACompile ErrorScore: N/A


Judge Duck Online | 评测鸭在线
Server Time: 2026-04-11 20:58:31 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠