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 double long double
double sq(double a) {
return a * a;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
// #ifndef ONLINE_JUDGE
// freopen("cowland.in", "r", stdin);
// freopen("cowland.out", "w", stdout);
// #endif
int n; cin >> n;
double x[n], r[n];
double r_f[n];
for (int i = 0; i < n; ++i)
{
cin >> x[i];
cin >> r[i];
}
stack<int>st;
for (int i = 0; i < n; ++i)
{
// if (st.size()) cout << st.top() << endl;
while (st.size()) {
double rad = sq(x[i] - x[st.top()]) / (4 * r_f[st.top()]);
r[i] = min(r[i], rad);
// cout << r[i] << endl;
if (r[i] >= r_f[st.top()]) {
st.pop();
continue;
} else break;
}
r_f[i] = r[i];
st.push(i);
}
cout << fixed << setprecision(3);
for (int i = 0; i < n; ++i)
{
cout << r_f[i] << 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... |