제출 #1077191

#제출 시각아이디문제언어결과실행 시간메모리
1077191serpent_121Balloons (CEOI11_bal)C++17
30 / 100
439 ms4432 KiB
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <numeric>
#include <cmath>
#include <cstring>
#include <climits>
#include <stack>
#include <bitset>
typedef long long ll;
using namespace std;
// https://oj.uz/problem/view/CEOI11_bal

int main() {
    ll n; cin >> n;
    stack<pair<double,long double>> s;
    for (int i = 0; i<n; i++) {
        double x,r; cin >> x >> r;
        long double constraint = r;
        while (!s.empty()) {
            long double c = (x-s.top().first)*(x-s.top().first)/(long double)(4*s.top().second);
            constraint = min(constraint,c);
            if (constraint > s.top().second) s.pop(); // we are sure that we can inflate to at least s.top().second
            else break; // now we are sure that a stronger constraint cannot be delivered
        }
        s.push({x,constraint});
        cout << constraint << '\n';
    }
}
#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...