제출 #89002

#제출 시각아이디문제언어결과실행 시간메모리
89002tarash117학교 설립 (IZhO13_school)C++14
5 / 100
2029 ms10124 KiB
#include<bits/stdc++.h>
using namespace std;
struct abc{
 int x;
 int i;
};
bool ioni(abc a,abc b){
  return a.x<=b.x;
}
int used1[3000001],used2[3000001];
int main(){
int n,m,s;
cin>>n>>m>>s;
abc a[n+1],b[n+1];
for(int i=1;i<=n;i++){
    cin>>a[i].x>>b[i].x;
    a[i].i=i;
    b[i].i=i;
}
sort(a+1,a+1+n,ioni);
sort(b+1,b+1+n,ioni);

int mx1=0;
for(int i=1;i<=m;i++){
    mx1+=a[i].x;
    used1[a[i].i]++;
}
int j=1;

for(int i=1;i<=n;i++){
   if(j>s)
    break;

    if(used1[b[i].i]==0){
        mx1+=b[i].x;
        j++;
    }

}

int mx2=0;
for(int i=1;i<=s;i++){
    mx2+=b[i].x;
    used2[b[i].i]++;
}
 j=1;

for(int i=1;i<=n;i++){
   if(j>m)
    break;

    if(used2[a[i].i]==0){
        mx2+=a[i].x;
        j++;
    }

}
cout<<max(mx1,mx2);


return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

school.cpp: In function 'int main()':
school.cpp:31:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    if(j>s)
    ^~
school.cpp:34:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     if(used1[b[i].i]==0){
     ^~
school.cpp:49:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    if(j>m)
    ^~
school.cpp:52:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     if(used2[a[i].i]==0){
     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...