# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
356812 | jnk | Balloons (CEOI11_bal) | C++17 | 159 ms | 11756 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
double x[200005], r[200005], res[200005];
int main(){
int n; cin >> n;
for(int i = 0; i < n; i++)
scanf("%lf %lf", &x[i], &r[i]);
res[0] = r[0];
stack<pair<double,double>> st;
st.push(make_pair(x[0], res[0]));
for(int i = 1; i < n; i++){
double ra = r[i];
while(!st.empty()){
auto p = st.top();
double xdif = x[i] - p.first;
double r = r - p.second;
ra = min(ra, xdif * xdif / (4 * p.second));
if(ra > p.second) st.pop();
else break;
}
res[i] = ra;
st.push(make_pair(x[i], res[i]));
}
for(int i = 0; i < n; i++)
printf("%.3f\n", res[i]);
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... |