#include <bits/stdc++.h>
using namespace std;
int q1[10001],q2[10001];
int main()
{
int n,x,y,mx1=0,mx2=0,s=1,hhh=0;
cin>>n>>x>>y;
pair<int,int> a[n],b[n];
for(int k=0;k<n;k++){
cin>>a[k].first;
cin>>a[k].second;
b[k].first=a[k].second;
b[k].second=a[k].first;
}
sort(a,a+n);
sort(b,b+n);
for(int k=0;k<x;k++){
mx1=mx1+a[n-s].first;
q1[a[n-s].first]=1;
s++;
}
for(int k=n-1;k>=0;k--){
if(sum==y)break;
if(q1[b[k].second]==0){
mx1=mx1+b[k].first;
hhh++;
}
}
s=1;
sum=0;
for(int k=0;k<y;k++){
mx2=mx2+b[n-s].first;
q2[b[n-s].first]=1;
s++;
}
for(int k=n-1;k>=0;k--){
if(sum==x)break;
if(q2[a[k].second]==0){
mx2=mx2+a[k].first;
sum++;
}
}
cout<<max(mx1,mx2);
return 0;
}
Compilation message
school.cpp: In function 'int main()':
school.cpp:26:12: error: 'sum' was not declared in this scope
if(sum==y)break;
^~~
school.cpp:36:4: error: 'sum' was not declared in this scope
sum=0;
^~~