QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#720870#7787. Maximum RatinghanmxCompile Error//C++171.8kb2024-11-07 14:32:402024-11-07 14:32:41

Judging History

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

  • [2024-11-07 14:32:41]
  • 评测
  • [2024-11-07 14:32:40]
  • 提交

answer

        }
    } 
    vector<pair<int,int>> ans(q+1);
    for(int i=1;i<=q;i++){
        int x,y;
        cin>>x>>y;
        ans[i]={x,y};
        if(y>0){
            p.push_back(y);
        }
    }
    auto b=p;
    sort(b.begin(),b.end());
    b.erase(unique(b.begin(),b.end()),b.end());
    auto find=[&](Info &a)->bool{
        if(a.num>0) return 1;
        return 0;
    };
    auto id=[&](int x)->int{
        return lower_bound(b.begin(),b.end(),x)-b.begin()+1;
    };
    for(int i=0;i<cnt;i++){
        seg.modify(id(p[i]),{1,p[i]});
    }
    auto check=[&](ll sum)->int{
        int l=1;
        int r=N;
        int ans=0;
        int p=0;
        while(l<=r){
            int m=(l+r)/2;
            if(seg.query(1,m).sum<=sum){
                ans=seg.query(1,m).num;
                p=m;
                l=m+1;
            }
            else r=m-1;
        }
        int x=seg.findfirst(p+1,N,find);
        if(x!=-1){
            if(p!=0) ans=seg.query(1,p).num;
            else ans=0;
            ll z;
            if(!p) z=sum;
            else z=sum-seg.query(1,p).sum;
            int val=seg.query(x,x).sum/seg.query(x,x).num;
            if(val!=0) ans+=z/val;
        } 
        return ans;
    };
    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]});
            //cout<<id(a[x])<<"\n";
        }
        a[x]=y;
        if(y<0){
            sum-=y;
        }
        else{
            cnt++;
            seg.modify(id(y),{1,y});
            //cout<<id(y)<<"\n";
        }
        //cout<<sum<<" "<<seg.query(1,N).sum<<"\n";
        if(sum>seg.query(1,N).sum) cout<<cnt+1<<"\n";
        else cout<<check(sum)+1<<"\n";
    }
    return 0;
}

Details

answer.code:1:9: error: expected declaration before ‘}’ token
    1 |         }
      |         ^
answer.code:2:5: error: expected declaration before ‘}’ token
    2 |     }
      |     ^
answer.code:3:5: error: ‘vector’ does not name a type
    3 |     vector<pair<int,int>> ans(q+1);
      |     ^~~~~~
answer.code:4:5: error: expected unqualified-id before ‘for’
    4 |     for(int i=1;i<=q;i++){
      |     ^~~
answer.code:4:17: error: ‘i’ does not name a type
    4 |     for(int i=1;i<=q;i++){
      |                 ^
answer.code:4:22: error: ‘i’ does not name a type
    4 |     for(int i=1;i<=q;i++){
      |                      ^
answer.code:12:12: error: ‘p’ was not declared in this scope
   12 |     auto b=p;
      |            ^
answer.code:13:9: error: expected constructor, destructor, or type conversion before ‘(’ token
   13 |     sort(b.begin(),b.end());
      |         ^
answer.code:14:5: error: ‘b’ does not name a type
   14 |     b.erase(unique(b.begin(),b.end()),b.end());
      |     ^
answer.code:15:16: error: non-local lambda expression cannot have a capture-default
   15 |     auto find=[&](Info &a)->bool{
      |                ^
answer.code:15:19: error: ‘Info’ has not been declared
   15 |     auto find=[&](Info &a)->bool{
      |                   ^~~~
answer.code: In lambda function:
answer.code:16:14: error: request for member ‘num’ in ‘a’, which is of non-class type ‘int’
   16 |         if(a.num>0) return 1;
      |              ^~~
answer.code: At global scope:
answer.code:19:14: error: non-local lambda expression cannot have a capture-default
   19 |     auto id=[&](int x)->int{
      |              ^
answer.code: In lambda function:
answer.code:20:16: error: ‘lower_bound’ was not declared in this scope
   20 |         return lower_bound(b.begin(),b.end(),x)-b.begin()+1;
      |                ^~~~~~~~~~~
answer.code: At global scope:
answer.code:22:5: error: expected unqualified-id before ‘for’
   22 |     for(int i=0;i<cnt;i++){
      |     ^~~
answer.code:22:17: error: ‘i’ does not name a type
   22 |     for(int i=0;i<cnt;i++){
      |                 ^
answer.code:22:23: error: ‘i’ does not name a type
   22 |     for(int i=0;i<cnt;i++){
      |                       ^
answer.code:25:17: error: non-local lambda expression cannot have a capture-default
   25 |     auto check=[&](ll sum)->int{
      |                 ^
answer.code:25:20: error: ‘ll’ has not been declared
   25 |     auto check=[&](ll sum)->int{
      |                    ^~
answer.code: In lambda function:
answer.code:27:15: error: ‘N’ was not declared in this scope
   27 |         int r=N;
      |               ^
answer.code:32:16: error: ‘seg’ was not declared in this scope
   32 |             if(seg.query(1,m).sum<=sum){
      |                ^~~
answer.code:39:15: error: ‘seg’ was not declared in this scope
   39 |         int x=seg.findfirst(p+1,N,find);
      |               ^~~
answer.code:43:13: error: ‘ll’ was not declared in this scope; did you mean ‘l’?
   43 |             ll z;
      |             ^~
      |             l
answer.code:44:20: error: ‘z’ was not declared in this scope
   44 |             if(!p) z=sum;
      |                    ^
answer.code:45:18: error: ‘z’ was not declared in this scope
   45 |             else z=sum-seg.query(1,p).sum;
      |                  ^
answer.code:47:29: error: ‘z’ was not declared in this scope
   47 |             if(val!=0) ans+=z/val;
      |                             ^
answer.code: At global scope:
answer.code:51:5: error: expected unqualified-id before ‘for’
   51 |     for(int i=1;i<=q;i++){
      |     ^~~
answer.code:51:17: error: ‘i’ does not name a type
   51 |     for(int i=1;i<=q;i++){
      |                 ^
answer.code:51:22: error: ‘i’ does not name a type
   51 |     for(int i=1;i<=q;i++){
      |                      ^
answer.code:74:5: error: expected unqualified-id before ‘return’
   74 |     return 0;
      |     ^~~~~~
answer.code:75:1: error: expected declaration before ‘}’ token
   75 | }
      | ^