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;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(3);
int n;
cin >> n;
vector<pair<int, double>> v;
while(n--) {
int x;
double r;
cin >> x >> r;
auto d=[x](pair<int, double> p) {
double dx=x-p.first;
return dx*dx/(4*p.second);
};
while(v.size()>=2&&d(v.end()[-1])>=d(v.end()[-2]))
v.pop_back();
double h=v.size()?min(r, d(v.back())):r;
cout << h << "\n";
while(v.size()&&h>=v.back().second)
v.pop_back();
v.emplace_back(x, h);
}
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... |