답안 #330447

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
330447 2020-11-25T09:18:56 Z Sho10 Sure Bet (CEOI17_sure) C++14
0 / 100
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;
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -