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);
stack<pair<double, double>> rad;
vector<double> res(n);
F0R(i, n) {
cin >> v[i].first >> v[i].second;
}
F0R(i, n) {
double ans = v[i].second;
while(!rad.empty()) {
ans = min(ans, ((rad.top().first - v[i].first)*(rad.top().first - v[i].first))/(4*rad.top().second));
if(ans >= rad.top().second) rad.pop();
else break;
}
res[i] = min(ans, v[i].second);
rad.push({v[i].first, res[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... |