#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,x,y,mx1=0,mx2=0,s=1;
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;
s++;
}
s=x+1;
for(int k=0;k<y;k++){
mx1=mx1+a[n-s].second;
}
s=1;
for(int k=0;k<y;k++){
mx2=mx2+b[n-s].first;
s++;
}
s=y+1;
for(int k=0;k<x;k++){
mx2=mx2+b[n-s].second;
}
cout<<max(mx1,mx2);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Correct |
2 ms |
488 KB |
Output is correct |
3 |
Correct |
2 ms |
488 KB |
Output is correct |
4 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
596 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
596 KB |
Output isn't correct |
7 |
Incorrect |
5 ms |
596 KB |
Output isn't correct |
8 |
Incorrect |
6 ms |
596 KB |
Output isn't correct |
9 |
Incorrect |
6 ms |
596 KB |
Output isn't correct |
10 |
Incorrect |
6 ms |
596 KB |
Output isn't correct |
11 |
Incorrect |
6 ms |
692 KB |
Output isn't correct |
12 |
Incorrect |
6 ms |
692 KB |
Output isn't correct |
13 |
Incorrect |
33 ms |
1128 KB |
Output isn't correct |
14 |
Incorrect |
71 ms |
1728 KB |
Output isn't correct |
15 |
Incorrect |
149 ms |
3140 KB |
Output isn't correct |
16 |
Incorrect |
173 ms |
3368 KB |
Output isn't correct |
17 |
Incorrect |
214 ms |
3992 KB |
Output isn't correct |
18 |
Incorrect |
230 ms |
4432 KB |
Output isn't correct |
19 |
Incorrect |
278 ms |
4756 KB |
Output isn't correct |
20 |
Incorrect |
288 ms |
5344 KB |
Output isn't correct |