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>
#define X first
#define Y second
#define pb push_back
#define pii pair<int, int>
typedef long long ll;
using namespace std;
const int MOD = 1e9 + 7;
const ll INF = 1e18;
const int OFF = (1 << 20);
int n;
int pos;
long double r;
stack< pair<long double, int> > s;
long double sol[200005];
int main () {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> pos >> r;
long double naj = r;
while (s.size() > 0) {
long double tren = s.top().Y-pos;
tren *= tren;
tren /= 4;
tren /= s.top().X;
if (tren <= naj) {
if (tren < s.top().X) {
naj = min(naj, tren);
break;
}
else {
s.pop();
//if (tren > naj) break;
naj = min(naj, tren);
}
}
else {
if (naj < s.top().X) break;
else s.pop();
}
}
sol[i] = naj;
s.push({naj, pos});
}
for (int i = 0; i < n; i++) cout << fixed << setprecision(3) << sol[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... |