# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1236378 | MinhKien | Balloons (CEOI11_bal) | C++20 | 0 ms | 0 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;
}