Submission #1052585

#TimeUsernameProblemLanguageResultExecution timeMemory
1052585VMaksimoski008Sure Bet (CEOI17_sure)C++17
60 / 100
2084 ms3272 KiB
#include <bits/stdc++.h> //#define int long long using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const int mod = 1e9 + 7; const int LOG = 20; const int maxn = 1e5 + 5; signed main() { int n; cin >> n; vector<double> a(n), b(n); for(int i=0; i<n; i++) cin >> a[i] >> b[i]; sort(a.rbegin(), a.rend()); sort(b.rbegin(), b.rend()); double ans = 0; double sum1 = 0; for(int i=0; i<n; i++) { sum1 += a[i]; double sum2 = 0; for(int j=0; j<n; j++) { sum2 += b[j]; ans = max(ans, min(sum1 - (i + j + 2), sum2 - (i + j + 2))); } } cout << setprecision(4) << fixed << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...