# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
703214 | a_aguilo | Balloons (CEOI11_bal) | C++14 | 524 ms | 9548 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;
int n;
long double getRad(long double d, long double r){
long double result = (long double)d*((long double)d/(4*r));
return result;
}
int main(){
cin >> n;
long double radius[n];
int position[n];
for(int i = 0; i < n; ++i) cin >> position[i] >> radius[i];
stack<pair<int, long double>> MyStack;
MyStack.push({position[0], radius[0]});
for(int i = 1; i < n; ++i){
int lastIdx = MyStack.size()-1;
radius[i] = min(radius[i], getRad(position[i]-MyStack.top().first, MyStack.top().second));
while(!MyStack.empty() and radius[i] >= MyStack.top().second){
MyStack.pop();
if(!MyStack.empty()) radius[i] = min(radius[i], getRad(position[i]-MyStack.top().first, MyStack.top().second));
}
MyStack.push({position[i], radius[i]});
}
for(int i = 0; i < n; ++i){
cout << fixed << setprecision(3) << radius[i] << endl;
}
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... |