#include <bits/stdc++.h>
using namespace std ;
const int MAX = 1e5 + 10 ;
long double a[MAX] , b[MAX] ;
int n ;
int main()
{
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;
cin>>n ;
for(int i = 0 ; i < n ; ++i)
cin>>a[i]>>b[i] ;
priority_queue<long double>q1 , q2 ;
for(int i = 0 ; i < n ; ++i)
q1.push(a[i]) , q2.push(b[i]) ;
long double x = 0 , y = 0 , ans = 0 ;
for(int i = 1 ; i <= n*2 ; ++i)
{
if(q1.size() && (x < y || !q2.size()))
x += q1.top() , q1.pop() ;
else
y += q2.top() , q2.pop() ;
ans = max(ans , min(x , y) - 1.00 * i) ;
}
return cout<<fixed<<setprecision(12)<<ans<<"\n" , 0 ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |