Submission #309780

# Submission time Handle Problem Language Result Execution time Memory
309780 2020-10-04T13:54:57 Z spike1236 Sure Bet (CEOI17_sure) C++14
0 / 100
1 ms 384 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sz size()
#define ll long long
#define all(_v) _v.begin(), _v.end()
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pvllvll pair <vector <ll>, vector <ll> >
#define ld long double
#define veci vector <int>
#define vecll vector <ll>


const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const double PI = 3.1415926535897932384626433832795;
const double eps = 1e-9;
const int MOD1 = 1e9 + 7;
const int MOD2 = 998244353;

const int MAXN = 1e5 + 10;
int n;
ld a[MAXN], b[MAXN];

ld ans;

void solve() {
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> 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);
    for(int i = 1; i <= n; ++i) a[i] += a[i - 1], b[i] += b[i - 1];
    for(int i = 1; i <= n; ++i) a[i] -= i, b[i] -= i;
    for(int x = 0; x <= n; ++x) {
        ld l = 0, r = 1e9, res = 0;
        for(int test = 1; test <= 100; ++test) {
            ld mid = (l + r) / 2;
            int y = a[x] - mid;
            y = min(y, n);
            if(y >= 0 && b[y] - mid >= x) res = mid, l = mid;
            else r = mid;
        }
        ans = max(ans, res);
    }
    cout << fixed << setprecision(10) << ans;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int T = 1;
    ///cin >> T;
    while(T--) solve(), cout << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -