# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161796 | dantoh000 | Sure Bet (CEOI17_sure) | C++14 | 2 ms | 376 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>
#define int long long
using namespace std;
main(){
int n;
scanf("%lld",&n);
int a[n], b[n];
for (int i = 0; i < n; i++){
double x,y;
scanf("%lf%lf",&x,&y);
x = (10000)*x + 0.1;
y = (10000)*y + 0.1;
a[i] = x, b[i] = y;
}
sort(a,a+n,greater<int>());
sort(b,b+n,greater<int>());
int ida = 0, idb = 0;
int suma = 0, sumb = 0;
int ans = 0;
for (int i = 1; i <= 2*n; i++){
if (ida != n && suma < sumb){
suma += a[ida];
ida++;
}
else{
sumb += b[idb];
idb++;
}
ans = max(ans,min(suma,sumb)-10000*i);
}
double actans = ((double)ans+0.1)/10000;
printf("%.4f",actans);
}
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... |