# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256664 | ChrisT | Sure Bet (CEOI17_sure) | C++17 | 75 ms | 3576 KiB |
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;
int main () {
int n;
scanf ("%d",&n);
vector<double> a(n),b(n);
for (int i = 0; i < n; i++) scanf ("%lf %lf",&a[i],&b[i]);
sort(a.rbegin(),a.rend()); sort(b.rbegin(),b.rend());
int bp = 0; double ret = 0, asum = 0, bsum = 0; int cnt = 0;
for (int i = 0; i < n; i++) {
asum += a[i]; ++cnt;
while (bp < n && min(asum,bsum + b[bp]) - 1 >= min(asum,bsum)) {
bsum += b[bp++]; ++cnt;
}
ret = max(ret,min(asum,bsum) - cnt);
}
printf ("%.4f\n",ret);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |