Submission #447441

#TimeUsernameProblemLanguageResultExecution timeMemory
447441fuad27Sure Bet (CEOI17_sure)C++14
0 / 100
1 ms204 KiB
#include<bits/stdc++.h> using namespace std; int main () { int n, A = 0, B = 0;cin>>n; long double ans = 0.0, sumA = 0.0, sumB = 0.0; long double a[n], b[n]; for(int i = 0;i<n;i++){ cin>>a[i]>>b[i]; } sort(a, a+n, greater<long double> ());sort(b, b+n, greater<long double> ()); while(A < n and B < n) { if(sumA <= sumB) { sumA += a[A++]; } else { sumB += b[B++]; } ans = max(ans, min(sumA, sumB) - (long double)(A) - (long double)(B)); } printf("%.4lf",(double)ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...