# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
706392 | vjudge1 | Balloons (CEOI11_bal) | C++11 | 161 ms | 2048 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<iostream>
#include<vector>
using namespace std;
vector<pair<long double,long double> > curr;
int n;
long double findval(int pos, long double x) {
return (curr[pos].first-x)*(curr[pos].first-x)/4.0/curr[pos].second;
}
int main () {
scanf("%d",&n);
for(int i = 0; i < n; i++) {
long double x,rad;
int minp = curr.size();
scanf("%Lf%Lf",&x,&rad);
if(curr.size() > 0) {
while(curr.size() > 1 && findval(curr.size()-1,x) > findval(curr.size()-2,x)) curr.pop_back();
rad = min(rad,findval(curr.size()-1,x));
}
while(curr.size() > 0 && rad+((long double) 1e-18) > curr.back().second) curr.pop_back();
curr.push_back(make_pair(x,rad));
printf("%.3Lf\n",rad);
}
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... |