#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,t=0,j=0,p=0,m,k,mx=-1,nx=-1,o,q;
cin>>n>>m>>k;
int a[n+1],b[n+1];
for(int i=1;i<=n;i++){
cin>>a[i]>>b[i];
t=t+a[i];
j=j+b[i];
}
if(t>=j){
while(k!=0){
for(int v=1;v<=n;v++){
if(b[v]>=mx){
mx=b[v];
q=v;
}
}
k--;
p=p+mx;
b[q]=-2;
a[q]=-2;
}
while(m!=0){
for(int v=1;v<=n;v++){
if(a[v]>=nx){
nx=a[v];
o=v;
}
}
m--;
p=p+nx;
a[o]=-2;
b[o]=-2;
}
}
else
{
while(m!=0){
for(int v=1;v<=n;v++){
if(a[v]>=nx){
xn=a[v];
q=v;
}
}
m--;
p=p+nx;
a[q]=-2;
b[q]=-2;
}
while(k!=0){
for(int v=1;v<=n;v++){
if(b[v]>=mx){
mx=b[v];
o=v;
}
}
k--;
p=p+mx;
b[o]=-2;
a[o]=-2;
}
}
cout<<p;
return 0;
}
Compilation message
school.cpp: In function 'int main()':
school.cpp:53:9: error: 'xn' was not declared in this scope
xn=a[v];
^~
school.cpp:53:9: note: suggested alternative: 'n'
xn=a[v];
^~
n