# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
359763 | shahriarkhan | Sure Bet (CEOI17_sure) | C++14 | 175 ms | 3820 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 ;
const long long c = 1e9 ;
int main()
{
int n ;
scanf("%d",&n) ;
priority_queue<long long> a , b ;
long long x = 0 , y = 0 , ans = 0 ;
for(int i = 1 ; i <= n ; ++i)
{
double ad , bd ;
cin>>ad>>bd ;
long long ac = (ad*c) , bc = (bd*c) ;
a.push(ac-c) , b.push(bc-c) ;
}
while(!a.empty())
{
x += a.top() , y -= c ;
a.pop() ;
while(!b.empty())
{
if(min(x-c,y+b.top())>=min(x,y))
{
x -= c , y += b.top() ;
b.pop() ;
}
else break ;
}
ans = max(ans,min(x,y)) ;
}
long double p = ans , q = c ;
cout<<fixed<<setprecision(4)<<p/q<<endl ;
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... |