QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#722682 | #7787. Maximum Rating | hanmx | Compile Error | / | / | C++17 | 1.7kb | 2024-11-07 19:54:58 | 2024-11-07 19:55:00 |
Judging History
answer
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>sum) 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 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<<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=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:9: error: ‘ans’ does not name a type 1 | ans[i]={x,y}; | ^~~ answer.code:2:9: error: expected unqualified-id before ‘if’ 2 | if(y>0){ | ^~ answer.code:5:5: error: expected declaration before ‘}’ token 5 | } | ^ answer.code:6:12: error: ‘p’ was not declared in this scope 6 | auto b=p; | ^ answer.code:7:9: error: expected constructor, destructor, or type conversion before ‘(’ token 7 | sort(b.begin(),b.end()); | ^ answer.code:8:5: error: ‘b’ does not name a type 8 | b.erase(unique(b.begin(),b.end()),b.end()); | ^ answer.code:9:16: error: non-local lambda expression cannot have a capture-default 9 | auto find=[&](Info &a)->bool{ | ^ answer.code:9:19: error: ‘Info’ has not been declared 9 | auto find=[&](Info &a)->bool{ | ^~~~ answer.code: In lambda function: answer.code:10:14: error: request for member ‘num’ in ‘a’, which is of non-class type ‘int’ 10 | if(a.num>sum) return 1; | ^~~ answer.code:10:18: error: ‘sum’ was not declared in this scope 10 | if(a.num>sum) return 1; | ^~~ answer.code: At global scope: answer.code:13:14: error: non-local lambda expression cannot have a capture-default 13 | auto id=[&](int x)->int{ | ^ answer.code: In lambda function: answer.code:14:16: error: ‘lower_bound’ was not declared in this scope 14 | return lower_bound(b.begin(),b.end(),x)-b.begin()+1; | ^~~~~~~~~~~ answer.code: At global scope: answer.code:16:5: error: expected unqualified-id before ‘for’ 16 | for(int i=0;i<cnt;i++){ | ^~~ answer.code:16:17: error: ‘i’ does not name a type 16 | for(int i=0;i<cnt;i++){ | ^ answer.code:16:23: error: ‘i’ does not name a type 16 | for(int i=0;i<cnt;i++){ | ^ answer.code:19:21: error: non-local lambda expression cannot have a capture-default 19 | auto findfirst=[&](auto findfirst,int p,int l,int r,int x,int y,ll tar)->int{ | ^ answer.code:19:69: error: ‘ll’ has not been declared 19 | auto findfirst=[&](auto findfirst,int p,int l,int r,int x,int y,ll tar)->int{ | ^~ answer.code: In lambda function: answer.code:20:22: error: ‘seg’ was not declared in this scope 20 | if(l>y||r<x||seg.info[p].sum<=tar){ | ^~~ answer.code:29:59: error: ‘seg’ was not declared in this scope 29 | res=findfirst(findfirst,p*2+1,mid+1,r,x,y,tar-seg.info[p*2].sum); | ^~~ answer.code: At global scope: answer.code:33:5: error: expected unqualified-id before ‘for’ 33 | for(int i=1;i<=q;i++){ | ^~~ answer.code:33:17: error: ‘i’ does not name a type 33 | for(int i=1;i<=q;i++){ | ^ answer.code:33:22: error: ‘i’ does not name a type 33 | for(int i=1;i<=q;i++){ | ^ answer.code:66:5: error: expected unqualified-id before ‘return’ 66 | return 0; | ^~~~~~ answer.code:67:1: error: expected declaration before ‘}’ token 67 | } | ^