Submission #878001

#TimeUsernameProblemLanguageResultExecution timeMemory
878001SunlightSure Bet (CEOI17_sure)C++14
100 / 100
62 ms2932 KiB
#include<bits/stdc++.h> using namespace std; const int MAX = 2e5 + 5; double arr[MAX], brr[MAX]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; for(int i = 1; i <= n; i ++) cin >> arr[i] >> brr[i]; sort(arr + 1, arr + 1 + n, greater<double>()); sort(brr + 1, brr + 1 + n, greater<double>()); double sA = 0, sB = 0, ans = 0; int cA = 0, cB = 0; for(int i = 1; i <= 2 * n; i ++) { if(sA < sB) { cA ++; sA += arr[cA]; } else { cB ++; sB += brr[cB]; } ans = max(ans, min(sA, sB) - i); } cout << fixed << setprecision(4) << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...