#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target(."avx2,bmi,bmi2,lzcnt,popcnt")
#pragma GCC optimize("Ofast")
#ifdef LOCAL
#include "debug/debug.hpp"
#else
#define print(...)
#endif
using ll = int;
using ld = double;
using ull = unsigned long long;
#define str string
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define ent cout << "\n";
#define sz(v) ll(v.size())
using namespace std;
const long long MOD = 1e9 + 7, inf = 1e18;
ld esp = 1e-7;
ld get_pos(ld x1, ld y1, ld x2, ld y2) {
// print()
ld s = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
return s;
}
void solve() {
ll n;
cin >> n;
ld x[n + 17], r[n + 17];
cout << fixed << setprecision(7);
stack<pair<ld, ld>> s;
for (ll i = 1; i <= n; i++) {
cin >> x[i] >> r[i];
while (sz(s)) {
auto [x1, r1] = s.top();
r[i] = min(r[i], (x1 - x[i]) * (x1 - x[i]) / (4 * r1));
print(x1, r1, r[i]);
if (r[i] >= r1)
s.pop();
else
break;
}
cout << r[i] << '\n';
s.push({x[i], r[i]});
}
}
int32_t main() {
#ifdef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
#endif
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
ll ttest = 1;
// cin >> ttest;
for (ll test_number = 1; test_number <= ttest; test_number++) {
solve();
}
return 0;
}
//
Compilation message (stderr)
bal.cpp:4:20: warning: '#pragma GCC option' is not a string [-Wpragmas]
4 | #pragma GCC target(."avx2,bmi,bmi2,lzcnt,popcnt")
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |