# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
309545 | bigg | Sure Bet (CEOI17_sure) | C++14 | 2069 ms | 4984 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;
typedef double ll;
const int MAXN = 1e5 + 10;
ll prefa[MAXN], prefb[MAXN], a[MAXN], b[MAXN];
int n;
int main(){
scanf("%d", &n );
for(int i = 1; i <= n; i++){
scanf("%lf %lf", &a[i], &b[i]);
}
sort(a + 1, a + 1 + n);
sort(b + 1, b + 1 + n);
for(int i = 1; i <= n; i++){
prefb[i] = prefb[i-1] + b[i];
prefa[i] = prefa[i-1] + a[i];
}
double ans = 0;
for(int numa = 0; numa <= n; numa++){
for(int numb = 0; numb <= n; numb++){
double bloc = prefb[n] - prefb[n - numb];
double aloc = prefa[n] - prefa[n - numa];
//printf("%lf %lf\n", bloc, aloc );
ans = max(ans, min(bloc - numb - numa, aloc - numa - numb));
}
}
printf("%.4lf\n", ans);
}
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... |