답안 #89067

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
89067 2018-12-10T09:26:24 Z beso123 학교 설립 (IZhO13_school) C++14
5 / 100
333 ms 7648 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 ans[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 3 ms 376 KB Output is correct
3 Incorrect 2 ms 408 KB Output isn't correct
4 Incorrect 2 ms 484 KB Output isn't correct
5 Incorrect 2 ms 484 KB Output isn't correct
6 Incorrect 3 ms 544 KB Output isn't correct
7 Incorrect 7 ms 688 KB Output isn't correct
8 Incorrect 7 ms 828 KB Output isn't correct
9 Incorrect 7 ms 828 KB Output isn't correct
10 Incorrect 7 ms 828 KB Output isn't correct
11 Incorrect 7 ms 828 KB Output isn't correct
12 Incorrect 9 ms 828 KB Output isn't correct
13 Incorrect 43 ms 1376 KB Output isn't correct
14 Incorrect 93 ms 2400 KB Output isn't correct
15 Incorrect 187 ms 4272 KB Output isn't correct
16 Incorrect 210 ms 4832 KB Output isn't correct
17 Incorrect 237 ms 5800 KB Output isn't correct
18 Incorrect 269 ms 6244 KB Output isn't correct
19 Incorrect 278 ms 6756 KB Output isn't correct
20 Incorrect 333 ms 7648 KB Output isn't correct