Submission #1236378

#TimeUsernameProblemLanguageResultExecution timeMemory
1236378MinhKienBalloons (CEOI11_bal)C++20
Compilation error
0 ms0 KiB
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <random>

using namespace std;

const int N = 2e5 + 10;

int n;
long double x, y, a, b;
long double xl[N], al[N];

long double dis(long double m) {
    long double p = sqrt((x - a) * (x - a) + (m - y) * (m - y));
    return p;
}

long double dis(int i, long double m) {
    return sqrt((a - xl[i]) * (a - xl[i]) + (m - al[i]) * (m - al[i]));
}

bool check(long double m) {

}

long double Find() {
    long double l = 0, r = b, ans = 0;

    for (int i = 1; i <= 50; ++i) {
        long double m = (l + r) / 2.0;

        if (dis(m) >= y + m) {
            if () {
                
            } else {
                r = m;
            }
        } else {
            r = m;
        }
    }

    return ans;
}

int main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);

    cin >> n;
    x = -1e9;
    y = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> a >> b;

        long double ans = Find();
        printf("%.3Lf\n", ans);

        xl[i] = a;
        al[i] = ans;

        if (abs(a + ans - x - y) <= 1e-10) continue;
        if (a + ans > x + y) {
            x = a;
            y = ans;
        }
    }

    return 0;
}

Compilation message (stderr)

bal.cpp: In function 'bool check(long double)':
bal.cpp:25:1: warning: no return statement in function returning non-void [-Wreturn-type]
   25 | }
      | ^
bal.cpp: In function 'long double Find()':
bal.cpp:34:17: error: expected primary-expression before ')' token
   34 |             if () {
      |                 ^