# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1114708 | hyakup | Sure Bet (CEOI17_sure) | C++17 | 57 ms | 3772 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> as, bs;
for( int i = 1; i <= n; i++ ){
double a, b; scanf("%lf %lf", &a, &b );
as.push_back(a);
bs.push_back(b);
}
sort( as.begin(), as.end() );
sort( bs.begin(), bs.end() );
double resp = 0, sa = 0, sb = 0;
for( int i = 1; i <= 2*n; i++ ){
if( as.empty() || ( !bs.empty() && sa > sb ) ){
sb += bs.back();
bs.pop_back();
}
else{
sa += as.back();
as.pop_back();
}
resp = max( resp, min( sa, sb ) - (double)i );
}
printf("%.4lf\n", resp );
}
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... |