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;
using lint = int64_t;
using ld = long double;
constexpr int _mod = int(1e9) + 7;
constexpr int _inf = 0x3f3f3f3f;
constexpr int _ninf = 0xcfcfcfcf;
constexpr lint _linf = 0x3f3f3f3f3f3f3f3f;
#define endl '\n'
int n;
vector<pair<lint,lint>> v;
stack<pair<lint,lint>> st;
lint solve(lint x, lint r) {
while(!st.empty()) {
auto [x1, r1] = st.top();
r = min(r, ((x1 - x) * (x1 - x)) / (4 * r1));
if(r >= r1) {
st.pop();
} else break;
}
st.push({x, r});
return r;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n;
v.resize(n);
for(auto &i : v) {
cin >> i.first >> i.second;
i.first *= 1000;
i.second *= 1000;
};
for(int i = 0; i < n; i++) {
cout << fixed << setprecision(3) << (double) solve(v[i].first, v[i].second) / 1000.0 << endl;
}
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... |