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;
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)
#define TRACE(x) cerr << #x << " = " << x << endl
typedef long long ll;
typedef long double ld;
typedef pair<ld, ld> point;
const int MAXN = 2e5 + 5;
const ld eps = 1e-12;
int n;
ld x[MAXN], r[MAXN];
stack <point> stek;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
cin >> n;
REP(i, n){
cin >> x[i] >> r[i];
ld radijus = r[i];
while(sz(stek)){
ld xx = stek.top().first - x[i];
xx *= xx;
radijus = min(radijus, ( xx ) / ((ld)4 * stek.top().second));
if(radijus > stek.top().second - eps)
stek.pop();
else{
cout << setprecision(3) << fixed << radijus << "\n";
stek.push(point(x[i], radijus));
break;
}
}
if(!sz(stek)){
cout << setprecision(3) << fixed << radijus << "\n";
stek.push(point(x[i], radijus));
}
}
}
# | 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... |