QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#722422#7787. Maximum RatinghanmxCompile Error//C++171.4kb2024-11-07 18:58:232024-11-07 18:58:24

Judging History

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

  • [2024-11-07 18:58:24]
  • 评测
  • [2024-11-07 18:58:23]
  • 提交

answer

    };
    for(int i=0;i<cnt;i++){
        seg.modify(id(p[i]),{1,p[i]});
    }
    auto findfirst=[&](auto findfirst,int p,int l,int r,int x,int y,ll tar)->int{
        if(l>y||r<x||seg.info[p].sum<=tar){
            return -1;
        }
        if(l==r){
            return l;
        }
        int mid=(l+r)/2;
        int res=findfirst(findfirst,p*2,l,mid,x,y,tar);
        if(res==-1){
            res=findfirst(findfirst,p*2+1,mid+1,r,x,y,tar-seg.info[p*2].sum);
        }
        return res;
    };
    for(int i=1;i<=q;i++){
        auto [x,y]=ans[i];
        if(a[x]<0){
            sum+=a[x];
        }
        else{
            cnt--;
            seg.modify(id(a[x]),{-1,-a[x]});
        }
        a[x]=y;
        if(y<0){
            sum-=y;
        }
        else{
            cnt++;
            seg.modify(id(y),{1,y});
        }
        int p=findfirst(findfirst,1,1,N,1,N,sum);
        cout<<seg.query(1,1).sum<<endl;
        //cout<<p<<"\n";
        if(p==-1){
            cout<<seg.query(1,N).num+1<<"\n";
        }
        else{
            int val=seg.query(p,p).sum/seg.query(p,p).num;
            //cout<<"v: "<<val<<"\n";
            ll sum1=0;
            if(p!=1) sum1=seg.query(1,p-1).sum;
            ll z=seg.query(1,p).sum-sum1;
            int r=0;
            if(p!=1) r=seg.query(1,p-1).num;
            cout<<r+z/val<<"\n";
        }
    }
    return 0;
}

Details

answer.code:1:5: error: expected declaration before ‘}’ token
    1 |     };
      |     ^
answer.code:2:5: error: expected unqualified-id before ‘for’
    2 |     for(int i=0;i<cnt;i++){
      |     ^~~
answer.code:2:17: error: ‘i’ does not name a type
    2 |     for(int i=0;i<cnt;i++){
      |                 ^
answer.code:2:23: error: ‘i’ does not name a type
    2 |     for(int i=0;i<cnt;i++){
      |                       ^
answer.code:5:21: error: non-local lambda expression cannot have a capture-default
    5 |     auto findfirst=[&](auto findfirst,int p,int l,int r,int x,int y,ll tar)->int{
      |                     ^
answer.code:5:69: error: ‘ll’ has not been declared
    5 |     auto findfirst=[&](auto findfirst,int p,int l,int r,int x,int y,ll tar)->int{
      |                                                                     ^~
answer.code: In lambda function:
answer.code:6:22: error: ‘seg’ was not declared in this scope
    6 |         if(l>y||r<x||seg.info[p].sum<=tar){
      |                      ^~~
answer.code:15:59: error: ‘seg’ was not declared in this scope
   15 |             res=findfirst(findfirst,p*2+1,mid+1,r,x,y,tar-seg.info[p*2].sum);
      |                                                           ^~~
answer.code: At global scope:
answer.code:19:5: error: expected unqualified-id before ‘for’
   19 |     for(int i=1;i<=q;i++){
      |     ^~~
answer.code:19:17: error: ‘i’ does not name a type
   19 |     for(int i=1;i<=q;i++){
      |                 ^
answer.code:19:22: error: ‘i’ does not name a type
   19 |     for(int i=1;i<=q;i++){
      |                      ^
answer.code:53:5: error: expected unqualified-id before ‘return’
   53 |     return 0;
      |     ^~~~~~
answer.code:54:1: error: expected declaration before ‘}’ token
   54 | }
      | ^