// IamHereForFun //
#include <bits/stdc++.h>
using namespace std;
#define LSOne(X) ((X) & -(X))
const int N = 2e5 + 5;
const int M = 15;
const int C = 26;
const int LG = 20;
const int R = 25e3 + 5;
const int B = 100;
const int O = 3e5 + 5;
const int INF = 1e9 + 5;
const int MOD = 998244353;
const int nx[] = {0, 1, 0, -1}, ny[] = {1, 0, -1, 0};
int n;
long double rad[N], d[N];
vector<pair<long double, int>> stk; // rad, id
long double val(long double x, pair<long double, int> p)
{
int id = p.second;
return (x - d[id])*(x - d[id])/4/p.first;
}
void solve()
{
cin >> n;
for (int x = 0; x < n; x++)
{
long double c, r;
cin >> c >> r;
d[x] = c;
while(!stk.empty())
{
r = min(r, val(c, stk.back()));
if(stk.back().first <= r) stk.pop_back();
else break;
}
rad[x] = r;
stk.push_back({r, x});
}
for (int x = 0; x < n; x++)
{
cout << fixed << setprecision(3) << rad[x] << "\n";
}
}
signed main()
{
// freopen("CP.INP", "r", stdin);
// freopen("CP.OUT", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
for (int x = 1; x <= t; x++)
{
solve();
}
return 0;
}
# | 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... |