# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
671533 | a_aguilo | Balloons (CEOI11_bal) | C++14 | 516 ms | 14820 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 vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
int n;
long double Radius(int d, long double r){
return (long double)(d)*((long double) d/(4*r));
}
void print(vector<pair<int, long double>>& V){
cout << V[0].first << " " << V[0].second;
for(int i = 1; i < V.size(); ++i) cout << " | "<< V[i].first << " " << V[i].second;
cout << endl;
}
int main(){
cin >> n;
int lastIdx;
int position[n];
long double radius[n];
vector<pair<int, long double>> MyStack;
cin >> position[0] >> radius[0];
MyStack.push_back({position[0], radius[0]});
for(int i = 1; i < n; ++i){
cin >> position[i] >> radius[i];
while((MyStack.size() > 0)){
lastIdx = MyStack.size()-1;
long double LastRad = Radius(position[i] - MyStack[lastIdx].first, MyStack[lastIdx].second);
if (radius[i] < LastRad) break;
radius[i] = LastRad;
if(radius[i] < MyStack[lastIdx].second) break;
else MyStack.pop_back();
}
MyStack.push_back({position[i], radius[i]});
//cout << i << endl;
//print(MyStack);
}
//cout << endl;
for(int i = 0; i < n; ++i) cout << fixed << 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... |