Submission #89004

#TimeUsernameProblemLanguageResultExecution timeMemory
89004tarash117Schools (IZhO13_school)C++14
15 / 100
648 ms10008 KiB
#include<bits/stdc++.h> using namespace std; struct abc{ int x; int i; }; bool ioni(abc a,abc b){ return b.x<=a.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; }

Compilation message (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...