Submission #877994

#TimeUsernameProblemLanguageResultExecution timeMemory
877994SunlightSure Bet (CEOI17_sure)C++14
0 / 100
0 ms600 KiB
#include<bits/stdc++.h> using namespace std; const int MAX = 1e5 + 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; max(cA, cB) < n; i ++) { if(sA < sB and cA < n) { 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...