This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define trav(a, x) for(auto& a : x)
#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define ROF(i, a, b) for (int i=(a); i>=(signed)(b); i--)
#define F0R(i, a) for (int i=0; i<(signed)(a); i++)
#define vi vector<int>
#define all(v) (v).begin(), (v).end()
#define f first
#define s second
typedef long long ll;
const int mod = 1e9 + 7, MOD = 998244353;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;
vector<pair<double, double>> v(n);
set<pair<double, int>> s;
vector<double> res(n);
F0R(i, n) {
cin >> v[i].first >> v[i].second;
}
F0R(i, n) {
if(i == 0) res[i] = v[i].second;
if(i != 0) {
auto tt = *(--s.upper_bound({v[i].first*1.0, (int)1e9}));
double raa = res[tt.second];
double aa = v[tt.second].first;
res[i] = min(v[i].second*1.0, (v[i].first - aa) * (v[i].first - aa) / (4 * raa));
double rb = res[i], b = v[i].first;
double ra, a;
auto t = *(--s.upper_bound({v[i].first*1.0, (int)1e9}));
ra = res[t.second];
a = v[t.second].first;
double k = sqrt(ra/rb);
double pp = (a - k * b) / (1 - k);
s.insert({pp, t.second});
}
s.insert({v[i].first, i});
}
F0R(i, n) {
cout << fixed << setprecision(3) << res[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... |