Submission #954477

#TimeUsernameProblemLanguageResultExecution timeMemory
954477mochaSure Bet (CEOI17_sure)C++14
60 / 100
2012 ms4856 KiB
#include <bits/stdc++.h> using namespace std; const int mx = 1e5+5; int n; long double a[mx], b[mx]; long double ans = 0; int main() { cin.tie(0);ios::sync_with_stdio(0); cin >> n; for (int i=0;i<n;i++) { cin >> a[i] >> b[i]; } sort(a, a+n); reverse(a, a+n); sort(b, b+n); reverse(b, b+n); long double sa = 0; for (int i=0;i<n;i++) { sa += a[i]; long double sb = 0; for (int j=0;j<n;j++) { sb += b[j]; ans = max(ans, min(sa - i - j - 2, sb - i - j - 2)); } } cout << fixed << setprecision(4) << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...