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 ll = long long;
using ld = long double;
using pii = pair<int, int>;
#define rep(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define all(x) (x).begin(), (x).end()
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define f first
#define s second
const int MAXN = 2e5 + 5;
int n;
pair<ld, ld> a[MAXN];
ld get(ld x1, ld r1, ld x) {
return (x1 - x) * (x1 - x) / 4 / r1;
}
int main() {
FAST_IO;
cout.precision(10);
cout.setf(ios::fixed);
cin >> n;
rep(i, n) {
cin >> a[i].f >> a[i].s;
}
vector<pair<ld, ld>> st;
rep(i, n) {
while (!st.empty()) {
a[i].s = min(a[i].s, get(st.back().f, st.back().s, a[i].f));
if (a[i].s > st.back().s) st.pop_back();
else break;
}
st.push_back(a[i]);
cout << a[i].s << '\n';
}
}
# | 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... |