답안 #866905

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
866905 2023-10-27T09:52:18 Z sleepntsheep Sure Bet (CEOI17_sure) C++17
60 / 100
838 ms 11764 KB
#include <cstdio>
#include <iomanip>
#include <cstring>
#include <cassert>
#include <string>
#include <deque>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <iostream>
#include <utility>
using namespace std;
using ll = long long;
using ld = long double;
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false)

#define N 200005
#define ALL(x) x.begin(), x.end()

int n;
ld a[N], b[N];

int ok(ld x)
{
    for (int take = 0; take <= 2*n; ++take)
    {
        int l = max(0,n-take), r = n-1, L=-1, R=-1;
        while (l <= r)
        {
            int y = (l+r)/2;
            if (a[y] - take >= x) l=y+1, L=y;
            else r=y-1;
        }
        if (L==-1) continue;
        R = n-take+(n-L);
        if (b[R] - take >= x) return 1;
    }
    return 0;
}

int main()
{
    ShinLena;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
    sort(a, a+n), sort(b, b+n);
    for (int i = n; i--;) a[i] += a[i+1], b[i] += b[i+1];

    ld l = 0, r = 1e9, iter=100;
    for (; --iter;)
    {
        ld y = (l+r)/2;
        if (ok(y)) l = y;
        else r = y;
    }
    cout << fixed << setprecision(4) << l;

    return 0;
}


# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 4 ms 2396 KB Output is correct
13 Correct 5 ms 2548 KB Output is correct
14 Correct 6 ms 2540 KB Output is correct
15 Correct 5 ms 2648 KB Output is correct
16 Correct 4 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 4 ms 2396 KB Output is correct
13 Correct 5 ms 2548 KB Output is correct
14 Correct 6 ms 2540 KB Output is correct
15 Correct 5 ms 2648 KB Output is correct
16 Correct 4 ms 2396 KB Output is correct
17 Correct 573 ms 5152 KB Output is correct
18 Correct 689 ms 5000 KB Output is correct
19 Correct 835 ms 5152 KB Output is correct
20 Correct 756 ms 6520 KB Output is correct
21 Correct 635 ms 6892 KB Output is correct
22 Correct 543 ms 6516 KB Output is correct
23 Correct 585 ms 6512 KB Output is correct
24 Correct 838 ms 6520 KB Output is correct
25 Correct 724 ms 6524 KB Output is correct
26 Runtime error 129 ms 11764 KB Execution killed with signal 11
27 Halted 0 ms 0 KB -