// In the name of God, the Most Gracious, the Most Merciful.
// @yavuzskarahan - iflbot();
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("popcnt,abm,mmx,avx,avx2,lzcnt,bmi,bmi2,fma,sse,sse2,sse3,sse4,sse4.1,sse4.2,tune=native")
#pragma GCC optimize("-fipa-sra,-fgcse-lm,-fgcse,inline,unroll-all-loops,no-stack-protector,O3,fast-math,Ofast")
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define file(x) freopen(x ".in", "r", stdin); freopen(x ".out", "w", stdout);
#define FOR(i, L, R) for (int i = (L); i <= (R); i++)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define int long long
#define ll long long
#define pb push_back
#define ub(v, a) upper_bound((v).begin(), (v).end(), (a))
#define lb(v, a) lower_bound((v).begin(), (v).end(), (a))
#define f first
#define s second
#define endl "\n"
#define tm (tl+(tr-tl)/2)
#define space << " " <<
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define now chrono::high_resolution_clock::now()
const long long N = 2e5+5;
const long long M = 2e5+5;
const long long K = 30;
// const long long SQRTN = sqrt(N);
// const long long MOD = 1e9+7;
// inline int sum(int a, int b) {return ((a%MOD)+(b%MOD))%MOD;}
// inline int mul(int a, int b) {return ((a%MOD)*(b%MOD))%MOD;}
// inline int epow(int n, int us){int cvp = 1; while(us){if (us%2){cvp *= n;}n *= n; us /= 2;} return cvp;}
int n, x[N], xj;
double r[N], rj;
inline int solve() {
cout << fixed << setprecision(3);
cin >> n;
stack<pair<int, double>> check;
FOR(i,1,n){
cin >> x[i] >> r[i];
while(!check.empty()){
xj = check.top().f;
rj = check.top().s;
r[i] = min(r[i], abs(x[i]-xj)*abs(x[i]-xj)/(4*rj));
if (r[i] >= rj){
check.pop();
continue;
}
else break;
}
check.push({x[i], r[i]});
cout << r[i] << endl;
}
return 0;
}
int32_t main() {
#ifdef LOCAL
auto start = now;
#endif
fast;
//init();
int t = 1;
//cin >> t;
while(t--){
solve();
}
#ifdef LOCAL
auto end = now;
chrono::duration<double> elapsed = end - start;
cout << endl << "runtime: " << endl << elapsed.count() << endl;
#endif
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... |