제출 #906668

#제출 시각아이디문제언어결과실행 시간메모리
906668KhanhMaBalloons (CEOI11_bal)C++14
10 / 100
163 ms4400 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...