# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
89074 |
2018-12-10T09:34:52 Z |
beso123 |
Schools (IZhO13_school) |
C++14 |
|
344 ms |
7544 KB |
#include <bits/stdc++.h>
using namespace std;
int n,m,s;
struct xy{
int x;
int y;
int z;
};
bool sort21(xy a,xy b){
return a.x>b.x;
}
bool sort211(xy a,xy b){
return a.y>b.y;
}
xy f[300001];
xy f1[300001];
int main(){
cin>>n>>m>>s;
for(int k=1;k<=n;k++){
cin>>f[k].x>>f[k].y;
f1[k].x=f[k].x;
f1[k].y=f[k].y;
f1[k].z=0;
f[k].z=0;
}
int cnt=0,cnt1=0;
sort(f+1,f+n+1,sort21);
for(int k=1;k<=m;k++){
cnt+=f[k].x;
f[k].z=1;
}
sort(f+1,f+n+1,sort211);
int r=0;
for(int k=1;k<=n;k++){
if(r<s){
if(f[k].z!=1){
cnt+=f[k].y;
f[k].z=1;
r++;
}
}
else break;
}
sort(f1+1,f1+n+1,sort211);
for(int k=1;k<=s;k++){
cnt1+=f1[k].y;
f1[k].z=1;
}
sort(f1+1,f1+n+1,sort21);
int r1=0;
for(int k=1;k<=n;k++){
if(r1<m){
if(f1[k].z!=1){
cnt1+=f[k].x;
f1[k].z=1;
r1++;
}
}
else break;
}
cout<<max(cnt,cnt1);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Correct |
2 ms |
476 KB |
Output is correct |
3 |
Incorrect |
2 ms |
476 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
492 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
500 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
540 KB |
Output isn't correct |
7 |
Incorrect |
6 ms |
668 KB |
Output isn't correct |
8 |
Incorrect |
8 ms |
668 KB |
Output isn't correct |
9 |
Incorrect |
7 ms |
700 KB |
Output isn't correct |
10 |
Incorrect |
7 ms |
700 KB |
Output isn't correct |
11 |
Incorrect |
8 ms |
700 KB |
Output isn't correct |
12 |
Incorrect |
7 ms |
720 KB |
Output isn't correct |
13 |
Incorrect |
44 ms |
1400 KB |
Output isn't correct |
14 |
Incorrect |
92 ms |
2396 KB |
Output isn't correct |
15 |
Incorrect |
192 ms |
4272 KB |
Output isn't correct |
16 |
Incorrect |
226 ms |
4844 KB |
Output isn't correct |
17 |
Incorrect |
232 ms |
5768 KB |
Output isn't correct |
18 |
Incorrect |
258 ms |
6392 KB |
Output isn't correct |
19 |
Incorrect |
311 ms |
6648 KB |
Output isn't correct |
20 |
Incorrect |
344 ms |
7544 KB |
Output isn't correct |