This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
#define all(x) x.begin(),x.end()
typedef long double ld;
typedef pair<ld,ld> pi;
const int maxn = 200010;
const int INF = LLONG_MAX/2;
const int mod = 1e9+7;
int n;
ld x[maxn], r[maxn];
int32_t main() {
FAST
// #ifndef ONLINE_JUDGE
// ifstream cin("input.txt");
// #endif
cin >> n;
for (int i =1;i<=n;i++) cin >> x[i] >> r[i];
stack <pi> s;
for (int i =1;i<=n;i++) {
while (!s.empty()) {
auto [xp, rp] = s.top();
r[i] = min(r[i], (x[i] - xp) * (x[i] - xp) / (4 * rp));
if (r[i] >= rp) s.pop();
else break;
}
s.push(pi(x[i], r[i]));
}
for (int i =1;i<=n;i++) cout << fixed << setprecision(6) << r[i] << "\n";
}
# | 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... |