# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134472 | dragonslayerit | Sure Bet (CEOI17_sure) | C++14 | 78 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 <cstdio>
#include <algorithm>
#include <functional>
double as[100005];
double bs[100005];
double all[200005];
int main(){
int N;
scanf("%d",&N);
for(int i=0;i<N;i++){
scanf("%lf %lf",&as[i],&bs[i]);
}
std::sort(as,as+N,std::greater<double>());
std::sort(bs,bs+N,std::greater<double>());
int ai=0,bi=0;
double again=0,bgain=0;
double best=0;
while(ai<N||bi<N){
if(bi==N||(ai<N&&again<bgain)){
again+=as[ai++];
}else{
bgain+=bs[bi++];
}
best=std::max(best,std::min(again,bgain)-ai-bi);
}
printf("%.4f\n",best);
}
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... |