# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
890733 | TimAni | Balloons (CEOI11_bal) | C++17 | 162 ms | 11156 KiB |
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 <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <stack>
#include <queue>
#include <cmath>
#include <array>
#include <iomanip>
using namespace std;
void setIO(string File_name) {
cin.tie(0)->sync_with_stdio(0);
if (File_name.size()) {
freopen((File_name + ".in").c_str(), "r", stdin);
freopen((File_name + ".out").c_str(), "w", stdout);
}
}
const long double eps = 1e-9;
void sol() {
int n; cin >> n;
vector<pair<double, double>> v(n);
for(int i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
vector<double> ans(n);
auto radius = [&](int curr, pair<double, double> prev) -> double {
double r = (v[curr].first - prev.first) * ((v[curr].first - prev.first)) / (4 * prev.second);
return r;
};
stack<pair<double, double>> mono;
for(int i = 0; i < n; i++){
double R = v[i].second;
while(!mono.empty()){
pair<double, double> t = mono.top();
double r = radius(i, t);
R = min(R, r);
if(R >= t.second){
mono.pop();
continue;
}
else break;
}
mono.push(make_pair(v[i].first, R));
ans[i] = R;
}
for(auto el : ans){
cout << fixed << setprecision(6) << el << ' ';
}
}
int main() {
setIO("");
int T = 1;
//cin >> T;
while (T--) sol();
return 0;
}
Compilation message (stderr)
# | 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... |