Submission #881730

#TimeUsernameProblemLanguageResultExecution timeMemory
881730alexddSchools (IZhO13_school)C++17
15 / 100
2090 ms4944 KiB
#include<bits/stdc++.h> using namespace std; const int NRIT = 4e7; int n,m,s; pair<int,pair<int,int>> v[300005]; int unde[300005]; mt19937 rnd(293123); signed main() { ios_base::sync_with_stdio(0);cin.tie(0); cin>>n>>m>>s; int a,b; for(int i=1;i<=n;i++) { cin>>a>>b; v[i] = {a-b,{a,b}}; } //sort(v+1,v+1+n); long long mxm=0; int nrs = NRIT/n; for(int pas2=0;pas2<nrs;pas2++) { sort(v+1,v+1+m+s); long long sum=0; for(int i=1;i<=s;i++) sum += v[i].second.second; for(int i=1;i<=m;i++) sum += v[m+s-i+1].second.first; mxm = max(mxm,sum); random_shuffle(v+1,v+1+n); } cout<<mxm; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...