Submission #878613

#TimeUsernameProblemLanguageResultExecution timeMemory
878613UmairAhmadMirzaSure Bet (CEOI17_sure)C++17
0 / 100
2 ms2396 KiB
#include <bits/stdc++.h> using namespace std; int const N=1e5+5; double A[N],B[N]; double Aprefix[N],Bprefix[N]; int main(){ int n; cin>>n; for (int i = 1; i <=n; ++i) cin>>A[i]>>B[i]; sort(A+1,A+n+1); sort(B+1,B+n+1); reverse(A+1,A+n+1); reverse(B+1,B+n+1); for(int i=1;i<=n;i++){ Aprefix[i]=Aprefix[i-1]+A[i]; Bprefix[i]=Bprefix[i-1]+B[i]; } double profit=0; for (int i = 0; i <=n; ++i) for(int j = 0; j <=n; j++){ double pro=min(Aprefix[i],Bprefix[j]); pro-=(i+j); profit=max(profit,pro); } cout<<profit<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...