QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#177057#6880. Operation HopeNesraychanWA 126ms13076kbC++141.3kb2023-09-12 15:14:052023-09-12 15:14:06

Judging History

你现在查看的是最新测评结果

  • [2023-09-12 15:14:06]
  • 评测
  • 测评结果:WA
  • 用时:126ms
  • 内存:13076kb
  • [2023-09-12 15:14:05]
  • 提交

answer

#include<bits/stdc++.h>
#define IL inline
#define reg register
#define N 100100
IL int read()
{
    reg int x=0; reg char ch=getchar();
    while(ch<'0'||ch>'9')ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x;
}

int n,m,a[N][2][3],mx[3];

struct Node
{
    int p,c,w;
    IL bool operator <(const Node &a)const{return w>a.w;}
};

bool type[N];
int ans=1e9;

IL void cmin(reg int &x,reg int y){x>y?x=y:0;}
IL void cmax(reg int &x,reg int y){x<y?x=y:0;}

IL void work()
{
    n=read(),memset(mx,0,sizeof(mx));
    for(reg int i=1;i<=n;++i)type[i]=0;
    std::priority_queue<Node>q[3];
    for(reg int i=1,j,k;i<=n;++i)
    {
        for(j=0;j<2;++j)for(k=0;k<3;++k)a[i][j][k]=read();
        for(j=3;j--;)cmax(mx[j],a[i][0][j]),q[j].push({i,0,a[i][0][j]});
    }
    while(1)
    {
        reg int id,w=-1,p;
        for(reg int o=3,val;o--;)
        {
            while(!q[o].top().c&&type[q[o].top().p])q[o].pop();
            val=mx[o]-q[o].top().w; if(w<val)w=val,id=o;
        }
        cmin(ans,w); if(type[p=q[id].top().p])break; type[p]=1;
        for(reg int o=3;o--;)q[o].push({p,1,a[p][1][o]}),cmax(mx[o],a[p][1][o]);
    }
    printf("%d\n",ans);

}

main()
{
    for(reg int t=read();t--;work());
}

详细

Test #1:

score: 0
Wrong Answer
time: 126ms
memory: 13076kb

input:

99
1000
532114032 55099632 197592060 601440117 964448551 693620489
68503446 149314803 308777541 408078601 977772348 978400861
185066959 236214410 460480442 842502015 709303988 675932475
793016330 161748857 511444978 852914351 281720292 552030608
9982160 15933748 8254470 175080600 567563770 461489051...

output:

982758431
499804923
99919477
99613700
99613700
99613700
99613700
99613700
114469
114469
114469
114469
114469
114469
114469
114469
114469
114408
114408
114408
114408
114408
114408
114408
114408
114408
114334
114334
114334
114334
114334
114334
114334
114334
114334
114334
114334
114334
114334
114334
11...

result:

wrong answer 5th lines differ - expected: '99922111', found: '99613700'