# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
330447 |
2020-11-25T09:18:56 Z |
Sho10 |
Sure Bet (CEOI17_sure) |
C++14 |
|
1 ms |
364 KB |
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod (10*10*10*10*10*10*10*10*10+7)
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll n;
double a[100005],b[100005];
int32_t main(){
CODE_START;
cin>>n;
for(ll i=1;i<=n;i++)
{
cin>>a[i]>>b[i];
a[i]--;
b[i]--;
}
sort(a+1,a+n+1);
sort(b+1,b+n+1);
reverse(a+1,a+n+1);
reverse(b+1,b+n+1);
double ans=0;
double s1=0,s2=0;
ll i=1,j=1;
while(i<=n){
s1+=(double)a[i];
// cout<<fixed<<setprecision(8)<<s1<<endl;
i++;
while(j<=n&&min((double)(s1-j),(double)(s2-i))<min((double)(s1-(double)(j+1)),(double)(s2+b[j]-i))){
s2+=(double)b[j];
j++;
}
ans=max(ans,min(s1-j+1,s2-i+1));
}
cout<<fixed<<setprecision(8)<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |