# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1208101 | pete555 | Balloons (CEOI11_bal) | C++20 | 144 ms | 4840 KiB |
#include<bits/stdc++.h>
using namespace std;
#define pi pair<int,int>
#define ll long long
#define pb push_back
#define pf push_front
void fileIO(string filename) {
freopen((filename + ".in").c_str(), "r", stdin);
freopen((filename + ".out").c_str(), "w", stdout);
}
int main()
{
cin.tie(0)->sync_with_stdio(false);
//fileIO("");
int n;
cin >> n;
vector<double> ans(n);
stack<pair<double, double>> S;
for(int i = 0; i < n; i++) {
double x, r;
cin >> x >> r;
double max_r = r;
while(S.size()) {
pair<double, double> a = S.top();
double b_r = (x - a.first) * (x - a.first) / (4 * a.second);
max_r = min(max_r, b_r);
if(b_r >= a.second) {
S.pop();
continue;
}
else {
break;
}
}
ans[i] = max_r;
S.push({x, max_r});
}
for(double x : ans) cout << fixed << setprecision(10) << x << '\n';
}
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... |