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 ld = long double;
const int DIM = 2e5 + 5;
ld x[DIM], r[DIM];
inline ld get( int i, int j ) {
return (x[i] - x[j]) * (x[i] - x[j]) / (4.0 * r[j]);
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
ld aux;
cin >> n;
for ( int i = 1; i <= n; ++i ) {
cin >> x[i] >> r[i];
}
vector<int> stk;
for ( int i = 1; i <= n; ++i ) {
while ( stk.size() && r[i] > (aux = get(i, stk.back())) ) {
r[i] = aux;
stk.pop_back();
}
stk.push_back(i);
}
cout << fixed << setprecision(3);
for ( int i = 1; i <= n; ++i ) {
cout << r[i] << "\n";
}
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... |