# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
412443 |
2021-05-26T22:13:01 Z |
Pbezz |
Sure Bet (CEOI17_sure) |
C++14 |
|
1 ms |
204 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
typedef pair<ll,ll> pii;
typedef tree<pii ,null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const ll MAXN = 301;
const ll MOD = 1e9+7;
const ll INF = 1e6+10;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n,i,x,y;
double sx,sy,ans=0;
cin>>n;
double a[n],b[n];
for(i=0;i<n;i++){
cin>>a[i]>>b[i];
}
sort(a,a+n,greater<double>());
sort(b,b+n,greater<double>());
x=0; y=0; sx=0; sy=0;
for(i=0;i<2*n;i++){
if(sx<=sy && x!=n){
sx+=a[x];
x++;
}else{
sy+=b[y];
y++;
}
//cout<<x<<" "<<y<<" "<<sx<<" "<<sy<<" "<<(double)(min(sx,sy)-(double)(x+y))<<endl;
ans = max(ans, (double)(min(sx,sy)-(double)(x+y)) );
}
cout<<setprecision(5)<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |