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>
#define forr(_a,_b,_c) for(_a = _b; _a <= _c; ++_a)
#define ford(_a,_b,_c) for(_a = (_b) + 1; _a --> _c;)
#define forf(_a,_b,_c) for(_a = _b; _a < _c; ++_a)
#define ll long long
#define ull unsigned long long
#define pb push_back
using namespace std;
const int nmax = 2e5 + 5;
const ll mod = 1e9 + 7;
int i;
struct balloons{
double x, r;
};
double radius(balloons left, balloons right){
return (right.x - left.x)*(right.x - left.x)/(4*left.r);
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
//freopen("main.inp", "r", stdin);
//freopen("main.out", "w", stdout);
int n; cin >> n;
stack<balloons> s;
forr(i,1,n){
balloons a; cin >> a.x >> a.r;
double current = a.r;
while(!s.empty()){
current = min(radius(s.top(), a), current);
if(s.top().r <= current){
s.pop();
continue;
} else {
break;
}
}
s.push(a);
cout << fixed << setprecision(3) << current << "\n";
}
return 0;
}
# | 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... |