답안 #89070

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
89070 2018-12-10T09:31:42 Z beso123 학교 설립 (IZhO13_school) C++14
5 / 100
322 ms 7472 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;
}
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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Correct 2 ms 380 KB Output is correct
3 Incorrect 2 ms 456 KB Output isn't correct
4 Incorrect 2 ms 500 KB Output isn't correct
5 Incorrect 2 ms 500 KB Output isn't correct
6 Incorrect 2 ms 544 KB Output isn't correct
7 Incorrect 6 ms 672 KB Output isn't correct
8 Incorrect 7 ms 672 KB Output isn't correct
9 Incorrect 7 ms 672 KB Output isn't correct
10 Incorrect 7 ms 672 KB Output isn't correct
11 Incorrect 7 ms 672 KB Output isn't correct
12 Incorrect 7 ms 672 KB Output isn't correct
13 Incorrect 132 ms 1396 KB Output isn't correct
14 Incorrect 94 ms 2352 KB Output isn't correct
15 Incorrect 183 ms 4400 KB Output isn't correct
16 Incorrect 213 ms 4768 KB Output isn't correct
17 Incorrect 236 ms 5692 KB Output isn't correct
18 Incorrect 266 ms 6320 KB Output isn't correct
19 Incorrect 280 ms 6576 KB Output isn't correct
20 Incorrect 322 ms 7472 KB Output isn't correct