답안 #89128

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
89128 2018-12-10T10:57:20 Z mate 학교 설립 (IZhO13_school) C++14
20 / 100
285 ms 14572 KB
#include<bits/stdc++.h>



using namespace std;
struct xyz{
 long long int x;
 long long int y;

};
bool for_sort(xyz forsort1,xyz forsort2){
  return forsort1.x>forsort2.x;
}

 xyz a[300001],b[300001],mx,q[300001];

int main(){

long long int n,m,s,i,ax,ay,bx,by,cnt=1;

cin>>n>>m>>s;

for( i=1;i<=n;i++){
    cin>>a[i].x>>b[i].x;
    a[i].y=i;
    b[i].y=i;
}
sort(a+1,a+1+n,for_sort);
sort(b+1,b+1+n,for_sort);


for(i=1;i<=m;i++){

    mx.x+=a[i].x;
    q[a[i].y].x++;
}


for(i=1;i<=n;i++){
    if(cnt>s)
       break;
    by=b[i].y;
    bx=b[i].x;
    if(q[by].x==0){
        mx.x+=bx;
        cnt++;
    }

}


for(i=1;i<=s;i++){
    mx.y+=b[i].x;
    q[b[i].y].y=1;
}
 cnt=1;

for(i=1;i<=n;i++){
    if(cnt>m)
       break;
    ay=a[i].y;
    ax=a[i].x;
    if(q[ay].y==0){
        mx.y+=ax;
        cnt++;
    }
    }
cout<<max(mx.x,mx.y);


return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 468 KB Output is correct
4 Incorrect 2 ms 472 KB Output isn't correct
5 Incorrect 2 ms 520 KB Output isn't correct
6 Incorrect 2 ms 532 KB Output isn't correct
7 Incorrect 6 ms 660 KB Output isn't correct
8 Incorrect 6 ms 788 KB Output isn't correct
9 Incorrect 6 ms 804 KB Output isn't correct
10 Incorrect 6 ms 804 KB Output isn't correct
11 Incorrect 6 ms 804 KB Output isn't correct
12 Incorrect 6 ms 804 KB Output isn't correct
13 Incorrect 36 ms 2272 KB Output isn't correct
14 Incorrect 72 ms 4192 KB Output isn't correct
15 Correct 151 ms 8224 KB Output is correct
16 Incorrect 169 ms 8944 KB Output isn't correct
17 Incorrect 202 ms 10864 KB Output isn't correct
18 Incorrect 226 ms 11904 KB Output isn't correct
19 Incorrect 247 ms 12820 KB Output isn't correct
20 Incorrect 285 ms 14572 KB Output isn't correct