This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |