Submission #89117

#TimeUsernameProblemLanguageResultExecution timeMemory
89117beso123Schools (IZhO13_school)C++14
20 / 100
308 ms7800 KiB
#include<bits/stdc++.h> using namespace std; struct xy{ int x; int y; }; int n,m,s; bool sort21(xy a,xy b){ return a.x>b.x; } int cnt1; int u1[300001],u2[300001]; int main(){ int n,m,s; cin>>n>>m>>s; xy a[n+1],b[n+1]; for(int 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,sort21); sort(b+1,b+1+n,sort21); for(int i=1;i<=m;i++){ cnt1+=a[i].x; u1[a[i].y]++; } int j=1; for(int i=1;i<=n;i++){ if(j>s) break; if(u1[b[i].y]==0){ cnt1+=b[i].x; j++; } } int cnt2=0; for(int k=1;k<=s;k++){ cnt2+=b[k].x; u2[b[k].y]=1; } j=1; for(int k=1;k<=n;k++){ if(j>m) break; if(u2[a[k].y]==0){ cnt2+=a[k].x; j++; } } cout<<max(cnt1,cnt2); return 0; }

Compilation message (stderr)

school.cpp: In function 'int main()':
school.cpp:32:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    if(j>s)
    ^~
school.cpp:35:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     if(u1[b[i].y]==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(u2[a[k].y]==0){
     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...